react-native-gh-notetaker
react-native-gh-notetaker copied to clipboard
Firebase API call fails
Hey, I keep hitting a problem with the call to Firebase. I've tried 5 different ways, but I keep getting this error when I hit: "Go To Notes":
Possible Unhandled Promise Rejection (id: 0):
Network request failed
TypeError: Network request failed
at XMLHttpRequest.xhr.onerror (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:24429:8)
at XMLHttpRequest.dispatchEvent (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:9939:15)
at XMLHttpRequest.setReadyState (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:25944:6)
at XMLHttpRequest.__didCompleteResponse (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:25802:6)
at http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:25877:52
at RCTDeviceEventEmitter.emit (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:9170:23)
at MessageQueue.__callFunction (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7250:23)
at http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7151:8
at guard (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7098:1)
at MessageQueue.callFunctionReturnFlushedQueue (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7150:1)
I've created a new firebase app 3 times, tried using the sample url, but nothing seems to work. Can you help?
Thanks, Casey
I've been banging my head against this for almost 4 days now... it seems like the Firebase API went through a lot of changes and this code isn't valid anymore.
What's funny is that a simple GET request to the REST API works, but never within Xcode. I've experimented with sending headers
, setting body
to null for a GET request... and still every call fails. No clue :(
So, I may have figured it out.
-Go into the app/utils/api.js file
-Change all the declarations of const url =...
to let url =...
Not sure why it works, but it does apparently work. I guess we are setting url to be the github-fetching url, so redefining it doesn't actually work. Admittedly, this seems like a subpar explanation. If I could get a better explanation, I'd be happy about it
Anyway, give that a shot & let us know if it works for you too
+1
@caseyrider Tried making all my var's let, as I didnt have them as const and still no luck. :(
Also tried this code base and it worked fine, only fail's within my code base. Doesn't make sense to me.