Yes.
Yes.
Environment:
OS: macOS High Sierra 10.13.2
Node: 9.4.0
Yarn: Not Found
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed)
react: ^16.2.0 => 16.2.0
react-native: ^0.52.0 => 0.52.0
Target Platform: iOS 8
Note: I upgraded to
0.52
last night usingreact-native-git-upgrade
, it had been working previously on0.51
.
http://192.168.0.13.xip.io:8081/index.delta?platform=ios&dev=true&minify=false
http://localhost:8081/debugger-ui/
in Chrome.Failed to load http://192.168.0.13.xip.io:8081/index.delta?platform=ios&dev=true&minify=false: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8081' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
App should load correctly and not throw an error when trying to debug JS remotely.
Failed to load http://192.168.0.13.xip.io:8081/index.delta?platform=ios&dev=true&minify=false: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8081' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
(Paste the link to an example project and exact instructions to reproduce the issue.)
Fresh react-native app using
react-native init
.
Did some digging, and found that if I modify https://github.com/facebook/metro/ _processDeltaRequest
to include mres.setHeader("Access-Control-Allow-Origin", "*");
it works. I don't believe this is enough to fix the issue though.
Just had to double check if it was indeed introduced since v0.51.0
which previously worked for me, it does indeed work as expected with 0.51.0
Above is the request using v0.52.0
.
The difference is the request header has Origin: http://localhost:8081
Hi @njbmartin,
You've saved my life!
I've upgraded to 0.52.0 as well and noticed that it wouldn't run on iOS with Remote Debugger On.
The 0.52.0 release seems to be quite buggy. I already wasted quite a few hours fighting with another issue that wouldn't let me build an app - #17274.
So, could you possibly change the title of this issue to something more alarming, so that the react-native maintainers notice it? Something like "Remote Debugging Doesn't Work on 0.52.0"?
I met the same problem on 0.52.0。
1.Unable to load script from assets 'index.android.bundle'. Make sure your bundle is packaged correctly or you're running a packager server.
2.http://localhost:8081/index.delta?platform=android&dev=true&minify=false
3.com.facebook.react.common.DebugServerException: Could not connect to development server.
I have same issue.
Looks like there was a lot of oversight in this release.
I too faced the other issues #17274 and #17610.
For this issue, I think it's definitely metro
or one of it's dependencies as I had a brief success downgrading the version, but it way too fiddly.
Facing the same issue with 0.52.
Facing the same without xip.io, just with IP-address of my Macbook while running application on device per ip-address of my working machine.
It happens only when debug-mode was enabled and failed then to load the code. Without debug-mode everything works as expected:
Failed to load http://192.168.178.24:8081/index.delta?platform=ios: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8081' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
I have already whitelisted this IP-Address and also localhost in Info.plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
<key>192.168.178.24</key>
<dict>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
But it still appears. At the end the ReactNative Application can't load its code while Debug-Mode is enabled. Without debug mode everything works as expected. Any ideas?
This is happening to me as well rn 0.52.0 only when debugging js remotely
Same here 🤙
But I fixed with downgrade react-native to 0.51.0
Cause I do not have enough time for waiting PR.
Respects.
Same here, I downgraded to react-native to 0.51.0 and react to 16.0.0 it works well in iOS Simulator even with the inspector on, but if I try to run in a real device (iPhone 7) I still got the issue.
@luanfelipecosta I did not downgraded react to 16.0.0, it works in real (iPhone 7) device. You should try upgrade react.
I've downgraded to [email protected] & [email protected], I'm getting the issue still - No idea but could this be a chrome related? Chrome: Version 63.0.3239.132
I'm not sure it is Chrome related, as I was able to downgrade to 0.51 and it works just fine. Take a look at the screenshots above. Something, somewhere, is adding origin: localhost
in 0.52
As an even better workaround... replace http://localhost:8081/debugger-ui/
with http://192.168.0.13.xip.io:8081/debugger-ui/
or whatever the ip is.
Voted not the best solution...
That's not usable for daily development environment. @njbmartin
I'm having the same issue on:
Simply downgrading to React-Native 0.51.0 (by just running npm i -S [email protected]
seems to fix the issue).
Remember that, after downgrading, you should also reset the cache:
watchman watch-del-all
npm run start -- --reset-cache
I'm using CRNA and for a workaround I used http://10.0.0.2:19001/debugger-ui/ where 10.0.0.2 is my LAN Ip address
đź‘Ť +1 on this, same issue for me:
"Failed to load http://10.0.1.57.xip.io:8081/index.delta?platform=ios&dev=true&minify=false: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8081' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
(index):188 Uncaught (in promise) TypeError: Failed to fetch"
For those having an issue with this, please check out the PR #17720 and see if that fixes the issue for you.
As a workaround, simply change your URL of Chrome from http://localhost:8081/debugger-ui/ to http://192.168.XXXX.XXXX.xip.io:8081/debugger-ui/
In @njbmartin 's case, http://192.168.0.13.xip.io:8081/debugger-ui/
Same issue with 0.52... Critical bug for me. I think we are also going to downgrade RN 0.51
Facing this issue even in 0.53. I have to use the IP address of my computer instead of localhost
Same problem here. Follow Sw0rdstream work around fixed for me.
A fix #17720 was merged in to master. Hopefully it won't be long before it's released as 0.52.3
and 0.53.0-rc.2
Same problem with RN version 0.53, sigh~.
The Expo keep loading with this error.... Finally, I have to stop remotely debug to keep learning RN..... so sad.
@ide Any plans to release this as a 0.52.3
hotfix?
No plans from me but we can cherry pick it into the upcoming 0.53 release.
It is possible to monkey patch if you can't wait for new release
node_modules/react-native/local-cli/server/middleware/getDevToolsMiddleware.js
patch-package
by running yarn add --dev patch-package postinstall-prepare
yarn patch-package react-native
, a file should be created in patches/react-native+0.52.patch
, this file needs to be committed in your repositoryyarn install
, or you can run yarn patch-package
directly if needed
"scripts": {
"prepare": "patch-package"
}
You can find more details on monkey patching in patch-package
repo.
Same program here (react-native version 0.52.2), then I downgrade to 0.51.0, it still happened......
But finally I have found a way to solve this problem, maybe it can help you
And now react-native Version is 0.51.0,
react version is 16.0.0,
run on my iPhone X and Simulator, everything is OK.
We face the same issue. Unsure how this is not a high priority candidate for a fix, I guess people don't need to debug their code on real devices?
We will downgrade to 0.51.0
to see if it fixes the issue. Will edit this post with an update.
Edit: 0.53.0
works, thanks!
@njbmartin sent a PR to fix this two weeks ago (thank you!), which was merged and released with 0.53.x.
After upgrading React Native to 0.53.0, the problem still exists. Please advise, thank you.
Remember to restart your packager and restart your browsers (or at least the debugger tab) after upgrading.
Upgrade 0.53.0
then watchman watch-del-all && react-native start --reset-cache
. That will work for you guys.
If you are on 0.53.0 then change IP to localhost.
Thanks @akash-cp it worked!
I am using expo, when updated for 0.53, I got a error:
react version mismatch between react-native 0.53.0 and native-scripts 0.52
package.json:
"expo": "^25.0.0"
"react": "16.2.0"
"react-native": "0.52.0"
+1
I am facing the same issue as @luanfelipecosta. I have the same package.json.
I tried running watchman watch-del-all && react-native start --reset-cache
,but it did not fix it.
I tried deleting the node_modules and re-installing the packages, that also doesn't fix the issue.
I think we should wait for this doc to get updated: https://github.com/react-community/create-react-native-app/blob/master/VERSIONS.md.
The latest version of expo
uses [email protected]
and therefore any projects created using CRN
might face this issue.
The fix I did was not hotfixed into 0.52
but is available in the latest [email protected]
.
As CRN
is now the default method of creating React Native apps, either expo
needs to be updated to use 0.53
or this fix needs to be hotfixed in 0.52
.
@kanteankit
a workaround for this problem (who is using expo) is install a CORS Toggle in google chrome.
http://bit.ly/2o4mVNI
for me worked as a charm.
@njbmartin So what you are saying is we should wait for Expo to release a new version that supports [email protected]
@njbmartin ah yes. You are right, I was using expo sdk 25 and ran into this issue.
@luanfelipecosta's suggestion works for me. Thanks man!
I'm still facing the same issue. I've tried all the possible solutions stated above but to no avail.
I have tried to upgrade RN to 0.53.3, yet it still gives the same problem.
Am on expo version 25.0.0.
Google Chrome plugin COORS Toggle as @luanfelipecosta suggested, works awesome ( http://bit.ly/2o4mVNI )
Upgrade react native to 0.53.3
watchman watch-del-all && react-native start --reset-cache
Start Remote JS Debugging
If the URL in Chrome is not http://localhost:8081/debugger-ui/
, change it.
Been getting this since about the same time this Issue appeared (Jan 15). Any time I create a CRNA app and try to debug it with Chrome. To get by, I would downgrade Expo and react native to previous versions: EXPO SDK to 24, React to 16.0.0, React Native to 0.51.x (matching the row shown for Expo SDK version 24.0.0. at https://github.com/react-community/create-react-native-app/blob/master/VERSIONS.md). I hadn't created a new CRNA app for a few weeks until today. Tried it and got the same thing. Came back here to see if there was any new news and saw the Google CORS Toggle suggestion from @luanfelipecosta. As others have reported, it works great. Hopefully this problem will get resolved before long, but until then, the CORS toggle is a quick and painless fix. Thanks @luanfelipecosta!
CORS Toggle might work great, but they ask for the permission "Read and change all your data on the websites that you visit"
@dgrcode you can find the source of it here (+ build it yourself) if you're worried; https://github.com/demesne/cors-toggle
[email protected]
removed the use of xip.io
which should solves this issue without the need for all the hacks suggested above. You can read more about it in the commit 40a8434
Try to install CORS toggle extension, it helped me with similar problem
I updated to [email protected]
still have the same issue.
i have this error on mac with
"react": "^16.3.1",
"react-native": "0.55.0",
i installed CORS toggle extension as @julioe says and now i can run in debug mode but with a lot of
warning "Warning: componentWillReceiveProps is deprecated and will be removed in the next major version."
@MaxInMoon I still have this issue in 0.54.0-rc.3. I had to get that version because of another issue on 0.54.4.
@julioe's fix worked for me as well! It seems to disable CORS for every tab though, not exactly safe.
@alainib These warnings are intended and expected behavior. See this blog post
https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html
Using http://localhost:8081/debugger-ui/
instead of http://192.168.0.21:8081/debugger-ui/
worked for me.
Thanks @akash-cp it worked!
rayronvictor style solved my problem too.
disabling the CORS plugin in chrome made it work!
@roadev how to disabling the CORS plugin? thanks.
@HFmoney Just ... click on it (on the chrome plugins bar - right side) and disable the "Enable cross-origin resource sharing".
The solution for this problem is simply install the extension "Allow-Control-Allow-Origin" in your chrome browser. this works for me you all can try.
@arfa123 You save my day! Thanks. The extension "Allow-Control-Allow-Origin" .
Just remember to disable it when not using because i cause trouble with some website.
If you also use Webstorm, you can do this.
like @rayronvictor Using http://localhost:8081/debugger-ui/
instead of http://192.168.0.21:8081/debugger-ui/
worked for me.
IDK why it's happening with 0.53. For now we can proceed with localhost
instead of your machine IP address. http://localhost:8081/debugger-ui/
I'm having this issue with RN 0.55.4. Localhost or my machine's IP didn't work. The only thing that worked for me was disabling CORS via the chrome extension.
didn't work for me.
problem solved, it's work me. http://localhost:8081/debugger-ui/
Note that http://127.0.0.1:8081/debugger-ui/ specifically doesn't seem to work, for CORS reasons.
In my case it is solved by deleting in Application debug menu "Dev Stettings" -> "Debug server host & port for device" erase all ip and port. after that it works again. JS Debug Remotly.
Working with RN 0.55.4, Iphone 12.1.1, google chrome latest as of Dec, 2018.
I solved it by using my IP address instead of "localhost"
http://192.168.0.21:8081/debugger-ui/
Adding this Extension to Chrome solves this issue:
Allow CORS: Access-Control-Allow-origin
Most helpful comment
As an even better workaround... replace
http://localhost:8081/debugger-ui/
withhttp://192.168.0.13.xip.io:8081/debugger-ui/
or whatever the ip is.Voted not the best solution...