Origin null is not allowed , XHR Error with Cordova on mobile
See original GitHub issueI know this Bug has been reported a few times, but there isn’t a real solution provided which works.
BUG: Origin null is not allowed by Access-Control-Allow-Origin.
Setup: Cordova 6.5.0 WkWebView Plugin Sentry Server Hosted Sentry Server allowed domains are set to * RavenJS 3.14.2
The Request in Curl:
curl 'https://sentry.io/api/XXXXXX/store/?sentry_client=raven-js%2F3.14.2&sentry_key=XXXXX&sentry_version=7' \
-XPOST \
-H 'Content-Type: text/plain;charset=UTF-8' \
-H 'Accept: */*' \
-H 'User-Agent: Mozilla/5.0 XXXXXX' \
-H 'Origin: null' \
--data-binary '{"project":"162985","logger":"javascript","platform":"javascript","request":{"headers":{"User-Agent":"Mozilla/5.0 XXXXX Browser"},"url":"file:///var/containers/Bundle/Application/XXXXX.app/www/index.html#/?_k=ljy9kz"},"exception":{"values":[{"type":"Error","value":"There was an error: 0.5179837562765125","stacktrace":{"frames":[{"lineno":null,"colno":null,"function":"dispatchEvent","in_app":true},{"filename":"app.js","lineno":75908,"colno":34,"function":"dispatchEvent","in_app":true},{"filename":"app.js","lineno":80514,"colno":24,"function":"perform","in_app":true},{"filename":"app.js","lineno":75833,"colno":39,"function":"handleTopLevelImpl","in_app":true},{"filename":"app.js","lineno":75750,"colno":25,"function":"handleTopLevel","in_app":true},{"filename":"app.js","lineno":75739,"colno":35,"function":"runEventQueueInBatch","in_app":true},{"filename":"app.js","lineno":69800,"colno":25,"function":"processEventQueue","in_app":true},{"filename":"app.js","lineno":81177,"colno":16,"function":"forEachAccumulated","in_app":true},{"lineno":null,"colno":null,"function":"forEach","in_app":true},{"filename":"app.js","lineno":69586,"colno":46,"function":"executeDispatchesAndRelease","in_app":true},{"filename":"app.js","lineno":70196,"colno":20,"function":"executeDispatchesInOrder","in_app":true},{"filename":"app.js","lineno":70173,"colno":42,"function":"executeDispatch","in_app":true},{"filename":"app.js","lineno":75665,"colno":9,"function":"invokeGuardedCallback","in_app":true},{"filename":"app.js","lineno":117956,"colno":24,"function":"throwError","in_app":true}]}}]},"extra":{"session:duration":3225},"user":{"email":"XXX","id":"-XXX"},"environment":"production","release":"0.1.1","event_id":"XXX"}'
Is there any way to fix this or do some kind of workaround? I have already rewritten the transport function to be able to test more options (even with window.fetch). It won’t work.
Edit: It looks like there is something wrong with WkWebView basically, because the origin shouldn’t be null. But sentry should be able to handle that, or am i missing some security problems?
Greets Marcus
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Cordova iOS "Origin null is not allowed by Access-Control ...
It's because there is no origin from WKWebView, so you cannot use CORS as it is. You need a plugin to allow XHR...
Read more >iOS : Cordova iOS error: Origin null is not allowed by Access ...
iOS : Cordova iOS error : Origin null is not allowed by Access-Control- Allow - Origin [ Beautify Your Computer ...
Read more >Origin null is not allowed by Access-Control ... - Ionic Forum
Hi, I have recently upgraded my application from Ionic 3 to Ionic 4. I have successfully been able to recreate most of my...
Read more >Cordova – Phonegap and jquery mobile : a href -> Origin null ...
Cordova – Phonegap and jquery mobile : a href -> Origin null is not allowed by Access-Control-Allow-Origin ... Im trying to use jquery...
Read more >CORDOVA and CORS - Auth0 Community
I'm running into an issue with CORDOVA and building for iOS. I initially had a build that ... “description”: “Origin null is not...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This makes it work in Cordova:
Raven.config(<dsn including secret key>, { allowSecretKey: true });
Have you tried using
allowSecretKey
and your secret DSN?We note in our raven-js config docs:
Try:
This will stop the sentry backend from doing the CORS validation.