-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested React Native projects result in TypeError: undefined is not an object (evaluating self.fetch) #9599
Comments
A most peculiar thing is that if remote JS debugging is turned on, the error goes away. |
@migueloller I'm also getting this since trying to upgrade to RN 0.33 - and this is my latest issue. It works in DEBUG mode for me as well. Did you ever get around this issue? |
I did not. 😞 I ended up removing the example folder completely and was going to look at the problem a bit closer at a later time. |
@migueloller Hey I got it working using RN 0.33 and doing a hack - following this project: https://github.com/johanneslumpe/react-native-browser-polyfill Specifically, I added the following to my app.js:
I added it right at the top. Now my fetches are working properly again. Seems like a dirty hack but I was a bit desperate to get it going on iOS10 and now it's running again. |
Interesting fix, I wonder if React Native should do this by itself? |
@migueloller Yeah there's a bit of powerful opinions either way so rather than wait until the respective teams make up their minds, I think the users have to solve this one on their own. |
I had the same issue for the past 2 months and I was always wondering what's going on. @willks - thanks, your fix works for me as well. |
Actually I had to do this:
because when debuging remotely I was getting: "cannot assign to read only property 'self' of object '#?" |
This is caused by the fetch polyfill from https://github.com/github/fetch / https://www.npmjs.com/package/whatwg-fetch requiring self or this to be defined. The workaround from other comments usually succeeds, but is not completely reliable because the packager/transpiler does not guarantee that that will run before whatever is calling fetch. Usually that isn't a problem because global.fetch is implemented as a lazy getter, but a module containing |
TypeError: undefined is not an object (evaluating self.fetch)
Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally! If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution. |
This issue has reappeared for me when upgrading from RN0.51 to RN0.53 makes the problem go away |
I just opened my project this morning after working on it last night without problem to see this weird error... ANyone find a fix or workaround for this?? |
I also have this issue all of a sudden. I have tried the global.self = global; fix to no avail. Running RN0.54 |
I rebooted my computer and my react app went from running fine to only running with expo in debug as described. @apolishch 's referenced fix worked for me for now, but seems very odd that it came out of no where. |
Also using a nested RN project and came across this issue in 0.55.4 @compojoom's solution fixed this for me: #9599 (comment) |
@alexfoxy where you able to find an alternative solution? I have also tried the global.self=global solution but am still having the same error |
Appearing for me.
|
I am noticing this issue only on Android
I used the above recommended fix:
|
I'm unsure how related this is to #5667 or #3975 but I've been trying to figure this out for 5 hours.
Here's the repo: https://github.com/bloveit/react-native-redux-navigation
I'm trying to create a React Native example for this module but there is an error that occurs when trying to run the example.
To reproduce:
I tried to pinpoint the error to a specific package, but no luck. I also tried nesting other React Native projects but the bug didn't happen (it seems to be an edge case).
Would greatly appreciate some insight on this bug!
Screenshot:
Thanks! 🍺
The text was updated successfully, but these errors were encountered: