Getting 404 for CORS request to Web API only in Chrome and only on server - google-chrome
I'm trying to POST data from a website to a Web API endpoint on the same server with the same domain name, but a different port number. It works with IE11 both locally and on our test server, but Chrome only works locally. On the test server I get a 404 error. As far as I can tell, it qualifies as a "simple" request, however the 404 error shows the HTTP Method was "OPTIONS", so it must be making a preflight request and failing on that.
zone.js:2933 OPTIONS http://example.com:8001/api/search/quickSearch?v=1.35.2664 404 (Not Found)
scheduleTask # zone.js:2933
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:411
onScheduleTask # zone.js:301
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:405
webpackJsonp.../../../../zone.js/dist/zone.js.Zone.scheduleTask # zone.js:236
webpackJsonp.../../../../zone.js/dist/zone.js.Zone.scheduleMacroTask # zone.js:259
(anonymous) # zone.js:2966
proto.(anonymous function) # zone.js:1366
(anonymous) # angular.js:12587
sendReq # angular.js:12332
serverRequest # angular.js:12084
processQueue # angular.js:16832
(anonymous) # angular.js:16876
$digest # angular.js:17971
(anonymous) # static.js:1502
schedulerFn # core.js:4351
webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.SafeSubscriber.__tryOrUnsub # Subscriber.js:240
webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.SafeSubscriber.next # Subscriber.js:187
webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber._next # Subscriber.js:128
webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber.next # Subscriber.js:92
webpackJsonp.../../../../rxjs/_esm5/Subject.js.Subject.next # Subject.js:56
webpackJsonp.../../../core/esm5/core.js.EventEmitter.emit # core.js:4319
checkStable # core.js:4718
onLeave # core.js:4797
onInvokeTask # core.js:4747
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:424
webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask # zone.js:192
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneTask.invokeTask # zone.js:499
ZoneTask.invoke # zone.js:488
timer # zone.js:2040
setTimeout (async)
scheduleTask # zone.js:2056
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:411
onScheduleTask # zone.js:301
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:405
webpackJsonp.../../../../zone.js/dist/zone.js.Zone.scheduleTask # zone.js:236
webpackJsonp.../../../../zone.js/dist/zone.js.Zone.scheduleMacroTask # zone.js:259
(anonymous) # zone.js:2072
proto.(anonymous function) # zone.js:1366
setTimeout # lodash.js:6663
timerExpired # lodash.js:10388
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:425
onInvokeTask # core.js:4744
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:424
webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask # zone.js:192
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneTask.invokeTask # zone.js:499
ZoneTask.invoke # zone.js:488
timer # zone.js:2040
setTimeout (async)
scheduleTask # zone.js:2056
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:411
onScheduleTask # zone.js:301
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:405
webpackJsonp.../../../../zone.js/dist/zone.js.Zone.scheduleTask # zone.js:236
webpackJsonp.../../../../zone.js/dist/zone.js.Zone.scheduleMacroTask # zone.js:259
(anonymous) # zone.js:2072
proto.(anonymous function) # zone.js:1366
setTimeout # lodash.js:6663
leadingEdge # lodash.js:10358
debounced # lodash.js:10425
fn # VM445:4
$eval # angular.js:18161
(anonymous) # angular.js:25998
(anonymous) # angular.js:28813
forEach # angular.js:403
$$writeModelToScope # angular.js:28811
writeToModelIfNeeded # angular.js:28804
(anonymous) # angular.js:28798
validationDone # angular.js:28723
processAsyncValidators # angular.js:28706
$$runValidators # angular.js:28650
$$parseAndValidate # angular.js:28791
$commitViewValue # angular.js:28757
(anonymous) # angular.js:28898
$eval # angular.js:18161
$apply # angular.js:18261
$$debounceViewValueCommit # angular.js:28897
$setViewValue # angular.js:28875
listener # angular.js:24822
dispatch # jquery.js:4737
elemData.handle # jquery.js:4549
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:425
onInvokeTask # core.js:4744
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:424
webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask # zone.js:192
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneTask.invokeTask # zone.js:499
invokeTask # zone.js:1540
globalZoneAwareCallback # zone.js:1566
(index):1 Failed to load http://example.com:8001/api/search/quickSearch?v=1.35.2664: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://example.com' is therefore not allowed access. The response had HTTP status code 404.
Here's what my Global.asax looks like to enable CORS requests:
protected void Application_BeginRequest(object sender, EventArgs e)
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", ConfigurationManager.AppSettings["RootUri"].TrimEnd('/'));
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST, HEAD, PUT, DELETE, OPTIONS");
HttpContext.Current.Response.AddHeader("Access-Control-Max-Age", "30");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Credentials", "true");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Accept, Accept-CH, Accept-Charset, Accept-Datetime, Accept-Encoding, Accept-Ext, Accept-Features, Accept-Language, Accept-Params, Accept-Ranges, Access-Control-Allow-Credentials, Access-Control-Allow-Headers, Access-Control-Allow-Methods, Access-Control-Allow-Origin, Access-Control-Expose-Headers, Access-Control-Max-Age, Access-Control-Request-Headers, Access-Control-Request-Method, Age, Allow, Alternates, Authentication-Info, Authorization, C-Ext, C-Man, C-Opt, C-PEP, C-PEP-Info, CONNECT, Cache-Control, Compliance, Connection, Content-Base, Content-Disposition, Content-Encoding, Content-ID, Content-Language, Content-Length, Content-Location, Content-MD5, Content-Range, Content-Script-Type, Content-Security-Policy, Content-Style-Type, Content-Transfer-Encoding, Content-Type, Content-Version, Cookie, Cost, DAV, DELETE, DNT, DPR, Date, Default-Style, Delta-Base, Depth, Derived-From, Destination, Differential-ID, Digest, ETag, Expect, Expires, Ext, From, GET, GetProfile, HEAD, HTTP-date, Host, IM, If, If-Match, If-Modified-Since, If-None-Match, If-Range, If-Unmodified-Since, Keep-Alive, Label, Last-Event-ID, Last-Modified, Link, Location, Lock-Token, MIME-Version, Man, Max-Forwards, Media-Range, Message-ID, Meter, Negotiate, Non-Compliance, OPTION, OPTIONS, OWS, Opt, Optional, Ordering-Type, Origin, Overwrite, P3P, PEP, PICS-Label, POST, PUT, Pep-Info, Permanent, Position, Pragma, ProfileObject, Protocol, Protocol-Query, Protocol-Request, Proxy-Authenticate, Proxy-Authentication-Info, Proxy-Authorization, Proxy-Features, Proxy-Instruction, Public, RWS, Range, Referer, Refresh, Resolution-Hint, Resolver-Location, Retry-After, Safe, Sec-Websocket-Extensions, Sec-Websocket-Key, Sec-Websocket-Origin, Sec-Websocket-Protocol, Sec-Websocket-Version, Security-Scheme, Server, Set-Cookie, Set-Cookie2, SetProfile, SoapAction, Status, Status-URI, Strict-Transport-Security, SubOK, Subst, Surrogate-Capability, Surrogate-Control, TCN, TE, TRACE, Timeout, Title, Trailer, Transfer-Encoding, UA-Color, UA-Media, UA-Pixels, UA-Resolution, UA-Windowpixels, URI, Upgrade, User-Agent, Variant-Vary, Vary, Version, Via, Viewport-Width, WWW-Authenticate, Want-Digest, Warning, Width, X-Content-Duration, X-Content-Security-Policy, X-Content-Type-Options, X-CustomHeader, X-DNSPrefetch-Control, X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto, X-Frame-Options, X-Modified, X-OTHER, X-PING, X-PINGOTHER, X-Powered-By, X-Requested-With");
// If a preflight request, end it so we don't fetch data.
if (HttpContext.Current.Request.HttpMethod == "OPTIONS")
{
HttpContext.Current.Response.End();
}
}
Why am I getting a 404 and how can I fix it?
Chrome and Safari may also make preflight OPTIONS requests for non-GET methods (e.g. POST).
I'm not sure what ConfigurationManager.AppSettings["RootUri"].TrimEnd('/') resolves to - the ACAO response headers must either be an asterisk or (as it appears you're trying to do) an FQDN, including the scheme and port (if the port isn't 80 or 443) - so in your case, it must have an EXACT value of "http://example.com:8001". It's much simpler to simply mirror back the value of the Origin request header (which will have that value).
Can you post the request and response headers?
Same issue calling a method
$.ajax({
url:'/Home/Read'
Use
$.ajax({
url:'../Home/Read'
Related
autodesk forge viewer.js update from 6.5.1 to 6.6 or 7.1, 2d hyperlink promise exception
change view from 3d to 2d view. In 6.5.1 viewer.load(document.getViewablePath(Views2D)); no exception In 6.6 viewer.load(document.getViewablePath(Views2D)); //promise exception in chrome console In 7.1 viewer.loadModel(document.getViewablePath(Views2D), {}); //promise exception in chrome console Uncaught (in promise) {instanceTree: null, maxTreeDepth: 0, err: undefined} Promise.then (async) loadHyperlinks # HyperlinkTool.js:323 activate # HyperlinkTool.js:123 activateTool # ToolController.js:265 f.load # Hyperlink.js:42 loadExtensionLocal # ExtensionManager.js:270 loadExtension # ExtensionManager.js:213 (anonymous) # ExtensionManager.js:312 o.onload # globals.js:183 load (async) u # globals.js:185 (anonymous) # ExtensionManager.js:310 loadExtensionAsync # ExtensionManager.js:309 loadExtension # ExtensionManager.js:205 (anonymous) # GuiViewer3D.js:412 setTimeout (async) D.createUI # GuiViewer3D.js:406 (anonymous) # GuiViewer3D.js:300 (anonymous) # GuiViewer3D.js:288 setTimeout (async) (anonymous) # GuiViewer3D.js:316 (anonymous) # Viewer3D.js:1228 (anonymous) # F2DLoader.js:420
Engineering is still taking time to address this issue. While we wait for their fix we can work around this issue by disabling the hyperlink extension in our load options: new Autodesk.Viewing.Private.GuiViewer3D(...),{disabledExtensions:{hyperlink:true}}
[Browser][cordova.js][xhrStatusChangeHandler] Could not XHR config.xml: Not Found
I am trying to develop an app using ionic 4, angular 6, Nodejs 10 and need to integrate google maps. When I run my app, I always see this error in the dev tools browser console - [Browser][cordova.js][xhrStatusChangeHandler] Could not XHR config.xml: Not Found. Copied the full console at the end. Following is the code I have - app.module.ts import { NgModule } from '#angular/core'; import { BrowserModule } from '#angular/platform-browser'; import { RouteReuseStrategy } from '#angular/router'; import { IonicModule, IonicRouteStrategy } from '#ionic/angular'; import { SplashScreen } from '#ionic-native/splash-screen/ngx'; import { StatusBar } from '#ionic-native/status-bar/ngx'; import { AppComponent } from './app.component'; import { AppRoutingModule } from './app-routing.module'; import { GoogleMaps } from '#ionic-native/google-maps'; #NgModule({ declarations: [AppComponent], entryComponents: [], imports: [ BrowserModule, IonicModule.forRoot(), AppRoutingModule ], providers: [ StatusBar, GoogleMaps, SplashScreen, { provide: RouteReuseStrategy, useClass: IonicRouteStrategy } ], bootstrap: [AppComponent] }) export class AppModule {} Following is my app.component.ts file - import { Component, ViewChild } from '#angular/core'; import { Platform, Nav } from '#ionic/angular'; import { SplashScreen } from '#ionic-native/splash-screen/ngx'; import { StatusBar } from '#ionic-native/status-bar/ngx'; import { HomePage } from './home/home.page'; #Component({ selector: 'app-root', templateUrl: 'app.component.html' }) export class AppComponent { #ViewChild(Nav) nav: Nav; rootPage: any; public appPages = [ { title: 'Home', url: '/home', icon: 'home' }, { title: 'List', url: '/list', icon: 'list' } ]; constructor( private platform: Platform, private splashScreen: SplashScreen, private statusBar: StatusBar ) { this.initializeApp(); } initializeApp() { this.platform.ready().then(() => { this.rootPage = HomePage; this.statusBar.styleDefault(); this.splashScreen.hide(); }); } } home.page.ts import { Component, OnInit } from '#angular/core'; import { GoogleMaps, GoogleMap } from '#ionic-native/google-maps/ngx'; import { Platform } from '#ionic/angular'; import { Environment } from '#ionic-native/google-maps'; #Component({ selector: 'app-home', templateUrl: 'home.page.html', styleUrls: ['home.page.scss'], }) export class HomePage implements OnInit { map: GoogleMap; constructor( private platform: Platform) {} async ngOnInit() { await this.platform.ready(); await this.loadMap(); } loadMap() { Environment.setEnv({ 'API_KEY_FOR_BROWSER_RELEASE': 'Agktkllffff1xGYLjDF0v1i2RSDrqDLjEmDdLI', 'API_KEY_FOR_BROWSER_DEBUG': '' }); this.map = GoogleMaps.create('map_canvas'); } } home.page.html <ion-header> <ion-toolbar> <ion-buttons slot="start"> <ion-menu-button></ion-menu-button> </ion-buttons> <ion-title> Home </ion-title> </ion-toolbar> </ion-header> <ion-content padding> <h3>GoogleMaps</h3> <div id = "map_canvas"> <button ion-button (click)="onButtonClick($event)">Demo</button> </div> </ion-content> I checked my Google Map API key and it doesn't has problem and double checked that I am using the correct one. My account is also fine and shouldn't be a problem with that. I am wondering what is causing this issue. The command that I am using to run my application is - ionic cordova run browser -l The url that opens up is http://172.29.54.8:8100/home console.log error details - Angular is running in the development mode. Call enableProdMode() to enable the production mode. cordova.js:1066 deviceready has not fired after 5 seconds. cordova.js:1059 Channel not fired: onPluginsReady cordova.js:1059 Channel not fired: onCordovaReady bootstrap.js:15 Ionic Native: deviceready did not fire within 5000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them. (anonymous) # bootstrap.js:15 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:421 push../node_modules/zone.js/dist/zone.js.Zone.runTask # zone.js:188 push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask # zone.js:496 ZoneTask.invoke # zone.js:485 timer # zone.js:2054 setTimeout (async) scheduleTask # zone.js:2075 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:407 push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask # zone.js:232 push../node_modules/zone.js/dist/zone.js.Zone.scheduleMacroTask # zone.js:255 scheduleMacroTaskWithCurrentZone # zone.js:1114 (anonymous) # zone.js:2090 proto.(anonymous function) # zone.js:1394 checkReady # bootstrap.js:13 ./node_modules/#ionic-native/core/index.js # index.js:11 __webpack_require__ # bootstrap:83 ./node_modules/#ionic-native/splash-screen/ngx/index.js # index.js:1 __webpack_require__ # bootstrap:83 ./src/app/app.module.ts # app.component.ts:12 __webpack_require__ # bootstrap:83 ./src/main.ts # main.ts:1 __webpack_require__ # bootstrap:83 0 # main.ts:12 __webpack_require__ # bootstrap:83 checkDeferredModules # bootstrap:45 webpackJsonpCallback # bootstrap:32 (anonymous) # main.js:1 cordova.js:1024 adding proxy for common cordova.js:1024 adding proxy for PluginEnvironment cordova.js:1024 adding proxy for CordovaGoogleMaps cordova.js:1024 adding proxy for PluginLocationService cordova.js:1024 adding proxy for PluginGeocoder cordova.js:1024 adding proxy for StatusBar cordova.js:1024 adding proxy for Device cordova.js:1024 adding proxy for SplashScreen StatusBarProxy.js:23 StatusBar is not supported zone.js:2969 GET http://172.29.54.8:8100/config.xml 404 (Not Found) scheduleTask # zone.js:2969 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:407 push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask # zone.js:232 push../node_modules/zone.js/dist/zone.js.Zone.scheduleMacroTask # zone.js:255 scheduleMacroTaskWithCurrentZone # zone.js:1114 (anonymous) # zone.js:3001 proto.(anonymous function) # zone.js:1394 readConfig # cordova.js:891 initAndShow # SplashScreenProxy.js:154 (anonymous) # SplashScreenProxy.js:165 build # cordova.js:51 require # cordova.js:66 localRequire # cordova.js:47 exports.mapModules # cordova.js:1352 (anonymous) # cordova.js:1152 f # cordova.js:645 Channel.fire # cordova.js:798 (anonymous) # cordova.js:1144 onScriptLoadingComplete # cordova.js:1574 scriptLoadedCallback # cordova.js:1591 (anonymous) # cordova.js:1545 wrapFn # zone.js:1188 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:421 push../node_modules/zone.js/dist/zone.js.Zone.runTask # zone.js:188 push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask # zone.js:496 invokeTask # zone.js:1540 globalZoneAwareCallback # zone.js:1566 error (async) customScheduleGlobal # zone.js:1666 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:407 onScheduleTask # zone.js:297 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:401 push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask # zone.js:232 push../node_modules/zone.js/dist/zone.js.Zone.scheduleEventTask # zone.js:258 (anonymous) # zone.js:1831 desc.set # zone.js:1244 requireEnsure # bootstrap:145 webpackAsyncContext # .*\.entry\.js$ include: \.entry\.js$ namespace object:780 o # ionic.core.js:6 t.In # ionic.core.js:9 $ # ionic.core.js:6 (anonymous) # ionic.core.js:6 r # ionic.core.js:6 (anonymous) # ionic.core.js:6 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke # zone.js:388 onInvoke # core.js:14060 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke # zone.js:387 push../node_modules/zone.js/dist/zone.js.Zone.run # zone.js:138 (anonymous) # zone.js:872 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:421 onInvokeTask # core.js:14051 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:420 push../node_modules/zone.js/dist/zone.js.Zone.runTask # zone.js:188 drainMicroTaskQueue # zone.js:595 Promise.then (async) scheduleMicroTask # zone.js:578 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:410 onScheduleTask # zone.js:297 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:401 push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask # zone.js:232 push../node_modules/zone.js/dist/zone.js.Zone.scheduleMicroTask # zone.js:252 scheduleResolveOrReject # zone.js:862 resolvePromise # zone.js:808 (anonymous) # zone.js:724 webpackJsonpCallback # bootstrap:25 (anonymous) # 12.js:1 cordova.js:866 [Browser][cordova.js][xhrStatusChangeHandler] Could not XHR config.xml: Not Found fail # cordova.js:866 xhrStatusChangeHandler # cordova.js:880 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:421 push../node_modules/zone.js/dist/zone.js.Zone.runTask # zone.js:188 push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask # zone.js:496 invokeTask # zone.js:1540 globalZoneAwareCallback # zone.js:1566 load (async) customScheduleGlobal # zone.js:1666 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:407 push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask # zone.js:232 push../node_modules/zone.js/dist/zone.js.Zone.scheduleEventTask # zone.js:258 (anonymous) # zone.js:1831 readConfig # cordova.js:886 initAndShow # SplashScreenProxy.js:154 (anonymous) # SplashScreenProxy.js:165 build # cordova.js:51 require # cordova.js:66 localRequire # cordova.js:47 exports.mapModules # cordova.js:1352 (anonymous) # cordova.js:1152 f # cordova.js:645 Channel.fire # cordova.js:798 (anonymous) # cordova.js:1144 onScriptLoadingComplete # cordova.js:1574 scriptLoadedCallback # cordova.js:1591 (anonymous) # cordova.js:1545 wrapFn # zone.js:1188 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:421 push../node_modules/zone.js/dist/zone.js.Zone.runTask # zone.js:188 push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask # zone.js:496 invokeTask # zone.js:1540 globalZoneAwareCallback # zone.js:1566 error (async) customScheduleGlobal # zone.js:1666 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:407 onScheduleTask # zone.js:297 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:401 push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask # zone.js:232 push../node_modules/zone.js/dist/zone.js.Zone.scheduleEventTask # zone.js:258 (anonymous) # zone.js:1831 desc.set # zone.js:1244 requireEnsure # bootstrap:145 webpackAsyncContext # .*\.entry\.js$ include: \.entry\.js$ namespace object:780 o # ionic.core.js:6 t.In # ionic.core.js:9 $ # ionic.core.js:6 (anonymous) # ionic.core.js:6 r # ionic.core.js:6 (anonymous) # ionic.core.js:6 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke # zone.js:388 onInvoke # core.js:14060 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke # zone.js:387 push../node_modules/zone.js/dist/zone.js.Zone.run # zone.js:138 (anonymous) # zone.js:872 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:421 onInvokeTask # core.js:14051 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:420 push../node_modules/zone.js/dist/zone.js.Zone.runTask # zone.js:188 drainMicroTaskQueue # zone.js:595 Promise.then (async) scheduleMicroTask # zone.js:578 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:410 onScheduleTask # zone.js:297 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:401 push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask # zone.js:232 push../node_modules/zone.js/dist/zone.js.Zone.scheduleMicroTask # zone.js:252 scheduleResolveOrReject # zone.js:862 resolvePromise # zone.js:808 (anonymous) # zone.js:724 webpackJsonpCallback # bootstrap:25 (anonymous) # 12.js:1 SplashScreenProxy.js:163 [Browser][cordova.js][xhrStatusChangeHandler] Could not XHR config.xml: Not Found (anonymous) # SplashScreenProxy.js:163 fail # cordova.js:869 xhrStatusChangeHandler # cordova.js:880 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:421 push../node_modules/zone.js/dist/zone.js.Zone.runTask # zone.js:188 push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask # zone.js:496 invokeTask # zone.js:1540 globalZoneAwareCallback # zone.js:1566 load (async) customScheduleGlobal # zone.js:1666 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:407 push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask # zone.js:232 push../node_modules/zone.js/dist/zone.js.Zone.scheduleEventTask # zone.js:258 (anonymous) # zone.js:1831 readConfig # cordova.js:886 initAndShow # SplashScreenProxy.js:154 (anonymous) # SplashScreenProxy.js:165 build # cordova.js:51 require # cordova.js:66 localRequire # cordova.js:47 exports.mapModules # cordova.js:1352 (anonymous) # cordova.js:1152 f # cordova.js:645 Channel.fire # cordova.js:798 (anonymous) # cordova.js:1144 onScriptLoadingComplete # cordova.js:1574 scriptLoadedCallback # cordova.js:1591 (anonymous) # cordova.js:1545 wrapFn # zone.js:1188 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:421 push../node_modules/zone.js/dist/zone.js.Zone.runTask # zone.js:188 push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask # zone.js:496 invokeTask # zone.js:1540 globalZoneAwareCallback # zone.js:1566 error (async) customScheduleGlobal # zone.js:1666 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:407 onScheduleTask # zone.js:297 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:401 push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask # zone.js:232 push../node_modules/zone.js/dist/zone.js.Zone.scheduleEventTask # zone.js:258 (anonymous) # zone.js:1831 desc.set # zone.js:1244 requireEnsure # bootstrap:145 webpackAsyncContext # .*\.entry\.js$ include: \.entry\.js$ namespace object:780 o # ionic.core.js:6 t.In # ionic.core.js:9 $ # ionic.core.js:6 (anonymous) # ionic.core.js:6 r # ionic.core.js:6 (anonymous) # ionic.core.js:6 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke # zone.js:388 onInvoke # core.js:14060 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke # zone.js:387 push../node_modules/zone.js/dist/zone.js.Zone.run # zone.js:138 (anonymous) # zone.js:872 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:421 onInvokeTask # core.js:14051 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:420 push../node_modules/zone.js/dist/zone.js.Zone.runTask # zone.js:188 drainMicroTaskQueue # zone.js:595 Promise.then (async) scheduleMicroTask # zone.js:578 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:410 onScheduleTask # zone.js:297 push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:401 push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask # zone.js:232 push../node_modules/zone.js/dist/zone.js.Zone.scheduleMicroTask # zone.js:252 scheduleResolveOrReject # zone.js:862 resolvePromise # zone.js:808 (anonymous) # zone.js:724 webpackJsonpCallback # bootstrap:25 (anonymous) # 12.js:1 bootstrap.js:10 Ionic Native: deviceready event fired after 15597 ms StatusBarProxy.js:23 StatusBar is not supported cordova.js:1024 adding proxy for map_0_605401752643 util.js:225 Google Maps JavaScript API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys
try { xhr.open("get", "/config.xml", true); xhr.send(); } catch(e) { fail('[Browser][cordova.js][readConfig] Could not XHR config.xml: ' + JSON.stringify(e)); } Try to find these lines in cordova.js file of the platform. I guess your application is in a sub-folder. Hence the error. Change it to try { xhr.open("get", "/<foldername>/config.xml", true); xhr.send(); } catch(e) { fail('[Browser][cordova.js][readConfig] Could not XHR config.xml: ' + JSON.stringify(e)); }
I meet the problem when I run command ionic cordova build browser and gulp wrong build content to the serve, wwwunber platforms/browser is the correct one the wwwunder project folder is wrong one
In my case I am launching my app like the following http://1.2.3.4/MyApp.BETA/ I think a better approach is to assume current directory instead of root. Therefor the fix should be: xhr.open("get", "./config.xml", true); Where is the source of this cordova.js? Who should be notified to fix this? Cordova? Thank you.
Push Mysql data to Elasticsearch using fluentd mysql-replicator Plugin
I am working on Fluentd, ElasticSearch and Kibana to push my mysql database data into elasticsearch I'm using plugin fluentd mysql-replicator plugin , But my fluntd throw following error: 2016-06-08 15:43:56 +0530 [warn]: super was not called in #start: called it forcedly plugin=Fluent::MysqlReplicatorInput 2016-06-08 15:43:56 +0530 [info]: listening dRuby uri="druby://127.0.0.1:24230" object="Engine" 2016-06-08 15:43:56 +0530 [info]: listening fluent socket on 0.0.0.0:24224 2016-06-08 15:43:57 +0530 [error]: mysql_replicator: missing primary_key. :tag=>replicator.livechat.chat_chennaibox.${event}.${primary_key} :primary_key=>chat_id 2016-06-08 15:43:57 +0530 [error]: mysql_replicator: failed to execute query. 2016-06-08 15:43:57 +0530 [error]: error: bad value for range 2016-06-08 15:43:57 +0530 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-mysql-replicator-0.5.2/lib/fluent/plugin/in_mysql_replicator.rb:105:in `block in poll' This is my configuration File for fluentd: #### ## Output descriptions: ## # Treasure Data (http://www.treasure-data.com/) provides cloud based data # analytics platform, which easily stores and processes data from td-agent. # FREE plan is also provided. # #see http://docs.fluentd.org/articles/http-to-td # # This section matches events whose tag is td.DATABASE.TABLE #<match td.*.*> # type tdlog # apikey YOUR_API_KEY # auto_create_table # buffer_type file # buffer_path /var/log/td-agent/buffer/td # <secondary> # type file # path /var/log/td-agent/failed_records # </secondary> #</match> ## match tag=debug.** and dump to console #<match debug.**> # type stdout #</match> #### ## Source descriptions: ## ## built-in TCP input ## #see http://docs.fluentd.org/articles/in_forward <source> type forward </source> ## built-in UNIX socket input #<source> # type unix #</source> # HTTP input # POST http://localhost:8888/<tag>?json=<json> # POST http://localhost:8888/td.myapp.login?json={"user"%3A"me"} # #see http://docs.fluentd.org/articles/in_http <source> type http port 8888 </source> ## live debugging agent <source> type debug_agent bind 127.0.0.1 port 24230 </source> #### ## Examples: ## ## File input ## read apache logs continuously and tags td.apache.access #<source> # type tail # format apache # path /var/log/httpdaccess.log # tag td.apache.access #</source> ## File output ## match tag=local.** and write to file #<match local.**> # type file # path /var/log/td-agent/apache.log #</match> ## Forwarding ## match tag=system.** and forward to another td-agent server #<match system.**> # type forward # host 192.168.0.11 # # secondary host is optional # <secondary> # host 192.168.0.12 # </secondary> #</match> ## Multiple output ## match tag=td.*.* and output to Treasure Data AND file #<match td.*.*> # type copy # <store> # type tdlog # apikey API_KEY # auto_create_table # buffer_type file # buffer_path /var/log/td-agent/buffer/td # </store> # <store> # type file # path /var/log/td-agent/td-%Y-%m-%d/%H.log # </store> #</match> #<source> # #type tail # format apache # tag apache.access # path /var/log/td-agent/apache_log/ssl_access_log.1 # read_from_head true # pos_file /var/log/httpd/access_log.pos #</source> #<match apache.access*> # type stdout #</match> #<source> # #type tail # format magento_system # tag magento.access # path /var/log/td-agent/Magento_log/system.log # pos_file /tmp/fluentd_magento_system.pos # read_from_head true #</source> #<match apache.access # type stdout #</match> #<source> # #type http # port 8080 # bind localhost # body_size_limit 32m # keepalive_timeout 10s #</source> #<match magento.access*> # type stdout #</match> #<match magento.access*> # #type elasticsearch # logstash_format true # host localhost # port 9200 #</match> <source> type mysql_replicator host 127.0.0.1 username root password gworks.mobi2 database livechat query select chat_name from chat_chennaibox; #query SELECT t2.firstname,t2.lastname, t1.* FROM status t1 INNER JOIN student_detail t2 ON t1.number = t2.number; primary_key chat_id # specify unique key (default: id) interval 10s # execute query interval (default: 1m) enable_delete yes tag replicator.livechat.chat_chennaibox.${event}.${primary_key} </source> #<match replicator.**> #type stdout #</match> <match replicator.**> type mysql_replicator_elasticsearch host localhost port 9200 tag_format (?<index_name>[^\.]+)\.(?<type_name>[^\.]+)\.(?<event>[^\.]+)\.(?<primary_key>[^\.]+)$ flush_interval 5s max_retry_wait 1800 flush_at_shutdown yes buffer_type file buffer_path /var/log/td-agent/buffer/mysql_replicator_elasticsearch.* </match> If there anyone who faced the same issue please suggests to me How to solve this problem.
I solve This Problem. My Problem is Missing primary_key in Query. wrong Query: <source> type mysql_replicator host 127.0.0.1 username root password xxxxxxx database livechat query select chat_name from chat_chennaibox; primary_key chat_id interval 10s # execute query interval (default: 1m) enable_delete yes tag replicator.livechat.chat_chennaibox.${event}.${primary_key} </source> In this Query i Mentioned primary_key is chat_id But, doesn't mention in query so, I got Error in mysql_replicator: missing primary_key. :tag=>replicator.livechat.chat_chennaibox.${event}.${primary_key} :primary_key=>chat_id Right Query: <source> #type mysql_replicator host localhost username root password xxxxxxx database livechat query SELECT chat_id, chat_name FROM chat_chennaibox primary_key chat_id interval 10s enable_delete yes tag replicator.livechat.chat_chennaibox.${event}.${primary_key} </source> You need to Mention primary_key in Query Field query SELECT chat_id, chat_name FROM chat_chennaibox Its Working For me.
this.isRTL is not a function error when using paper-dropdown-menu webcomponent
Getting this error when loading up the paper-dropdown-menu webcomponent. Uncaught TypeError: this._isRTL is not a function Longer stacktrace for SEO: Uncaught TypeError: this._isRTL is not a function get _localeHorizontalAlign # iron-dropdown.html:306_updateOverlayPosition # iron-dropdown.html:461_positionTargetChanged # iron-dropdown.html:405_observerEffect # polymer.html:1562_effectEffects # polymer.html:1405_propertySetter # polymer.html:1389setter # polymer.html:1468attached # iron-fit-behavior.html:222_invokeBehavior # polymer-micro.html:433_doBehavior # polymer-micro.html:426(anonymous function) # polymer-micro.html:210_makeReady # polymer-micro.html:111(anonymous function) # polymer-micro.html:117 polymer-mini.html:2046 Uncaught TypeError: Cannot read property 'getWidth' of undefined(anonymous function) # app-drawer-layout.html:189complete # polymer-mini.html:2085Debouncer.boundComplete # polymer-mini.html:2062_atEndOfMicrotask # polymer-mini.html:2040window.MutationObserver.observe.characterData # polymer-mini.html:2055
Apparently Polymer 1.5 is not compatible with paper-dropdown-menu version ~1.2.1. I had to downgrade to Polymer 1.4 to use the paper-dropdown-menu. Edit: The problem was the this component is not compatible with the Shadow DOM.
Cygnus: Bad HTTP notification (curl/7.29.0 user agent not supported)
I installed cygnus version 0.8.2 on Fiware instance basing on the image CentOS-7-x64 using: sudo yum install cygnus I configured my agent as the following: cygnusagent.sources = http-source cygnusagent.sinks = mongo-sink cygnusagent.channels = mongo-channel #============================================= # source configuration # channel name where to write the notification events cygnusagent.sources.http-source.channels = mongo-channel # source class, must not be changed cygnusagent.sources.http-source.type = org.apache.flume.source.http.HTTPSource # listening port the Flume source will use for receiving incoming notifications cygnusagent.sources.http-source.port = 5050 # Flume handler that will parse the notifications, must not be changed cygnusagent.sources.http-source.handler = com.telefonica.iot.cygnus.handlers.OrionRestHandler # URL target cygnusagent.sources.http-source.handler.notification_target = /notify # Default service (service semantic depends on the persistence sink) cygnusagent.sources.http-source.handler.default_service = def_serv # Default service path (service path semantic depends on the persistence sink) cygnusagent.sources.http-source.handler.default_service_path = def_servpath # Number of channel re-injection retries before a Flume event is definitely discarded (-1 means infinite retries) cygnusagent.sources.http-source.handler.events_ttl = 10 # Source interceptors, do not change cygnusagent.sources.http-source.interceptors = ts gi # TimestampInterceptor, do not change cygnusagent.sources.http-source.interceptors.ts.type = timestamp # GroupinInterceptor, do not change cygnusagent.sources.http-source.interceptors.gi.type = com.telefonica.iot.cygnus.interceptors.GroupingInterceptor$Builder # Grouping rules for the GroupingInterceptor, put the right absolute path to the file if necessary # See the doc/design/interceptors document for more details cygnusagent.sources.http-source.interceptors.gi.grouping_rules_conf_file = /usr/cygnus/conf/grouping_rules.conf # ============================================ # OrionMongoSink configuration # sink class, must not be changed cygnusagent.sinks.mongo-sink.type = com.telefonica.iot.cygnus.sinks.OrionMongoSink # channel name from where to read notification events cygnusagent.sinks.mongo-sink.channel = mongo-channel # FQDN/IP:port where the MongoDB server runs (standalone case) or comma-separated list of FQDN/IP:port pairs where the MongoDB replica set members run cygnusagent.sinks.mongo-sink.mongo_hosts = 127.0.0.1:27017 # a valid user in the MongoDB server (or empty if authentication is not enabled in MongoDB) cygnusagent.sinks.mongo-sink.mongo_username = # password for the user above (or empty if authentication is not enabled in MongoDB) cygnusagent.sinks.mongo-sink.mongo_password = # prefix for the MongoDB databases cygnusagent.sinks.mongo-sink.db_prefix = kura_ # prefix pro the MongoDB collections cygnusagent.sinks.mongo-sink.collection_prefix = kura_ # true is collection names are based on a hash, false for human redable collections cygnusagent.sinks.mongo-sink.should_hash = false #============================================= # mongo-channel configuration # channel type (must not be changed) cygnusagent.channels.mongo-channel.type = memory # capacity of the channel cygnusagent.channels.mongo-channel.capacity = 1000 # amount of bytes that can be sent per transaction cygnusagent.channels.mongo-channel.transactionCapacity = 100 I tried to test it locally using the following curl command: URL=$1 curl $URL -v -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' --header "Fiware-Service: qsg" --header "Fiware-ServicePath: testsink" -d #- <<EOF { "subscriptionId" : "51c0ac9ed714fb3b37d7d5a8", "originator" : "localhost", "contextResponses" : [ { "contextElement" : { "attributes" : [ { "name" : "temperature", "type" : "float", "value" : "26.5" } ], "type" : "Room", "isPattern" : "false", "id" : "Room1" }, "statusCode" : { "code" : "200", "reasonPhrase" : "OK" } } ] } EOF but I got this exception: 2015-10-06 14:38:50,138 (1251445230#qtp-1186065012-0) [INFO - com.telefonica.iot.cygnus.handlers.OrionRestHandler.getEvents(OrionRestHandler.java:150)] Starting transaction (1444142307-244-0000000000) 2015-10-06 14:38:50,140 (1251445230#qtp-1186065012-0) [WARN - com.telefonica.iot.cygnus.handlers.OrionRestHandler.getEvents(OrionRestHandler.java:180)] Bad HTTP notification (curl/7.29.0 user agent not supported) 2015-10-06 14:38:50,140 (1251445230#qtp-1186065012-0) [WARN - org.apache.flume.source.http.HTTPSource$FlumeHTTPServlet.doPost(HTTPSource.java:186)] Received bad request from client. org.apache.flume.source.http.HTTPBadRequestException: curl/7.29.0 user agent not supported at com.telefonica.iot.cygnus.handlers.OrionRestHandler.getEvents(OrionRestHandler.java:181) at org.apache.flume.source.http.HTTPSource$FlumeHTTPServlet.doPost(HTTPSource.java:184) at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) at javax.servlet.http.HttpServlet.service(HttpServlet.java:814) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) Any idea of what can be the cause of this exception?
Cygnus version <= 0.8.2 controls the HTTP headers, only accepting user-agets starting by orion. This has been fixed in 0.9.0 (this is the particular issue). Thus, you have two options: Avoiding sending such a user-agent header. According to the curl documentation, you can use the -A, --user-agent <agent string> option in order to modify the user-agent and sending something starting by orion (e.g. orion/0.24.0). Moving to Cygnus 0.9.0 (in order to avoid you have to install it from the sources, I'll upload along the day a RPM in the FIWARE repo).