Environment:
- Operating System version: Ubuntu 18.04
- Browser version: Not relevant
- Firebase SDK version: v6.0.4
- Firebase Product: Firestore (database)
- Expo version: v32.0.6
Problem description:
I’m developing a app with React Native and Expo and it has been in development since earlier this year. I started intergrating Firebase Firestore and Auth in my app right away with this package and I even have a production build in Testflight, meaning that Firebase works perfectly. I never had a problem with Firebase before.
Yesterday I changed some configuration in my app, such as the display name, some email templates and I’ve added a custom email domain to send emails from. I also upgraded some packages of my application, including Firebase. I’ve upgraded these versions:
- firebase from “v5.11.1” to “v6.0.4”.
- react-navigation from “v3.9.1” to “v3.11.0”. (Probably not relevant)
After all these changes I was still able to register and login my app, but as of today my Firestore is crashing all the time. I would like to make it clear that my firebase authentication works fine.
This is the error I’m getting, it may be different sometimes but it is always the Firestore:
Steps to reproduce:
I would love to provide the steps needed to reproduce this problem, but this seems like a strange bug to me so I’m really not sure if/how you can reproduce this issue.
Relevant Code:
Please let me know what code you would like to see. I’m not sure what to post because my application always worked and I did not change any code.
More information:
You can find a post about this on Reddit which I have made here.
I had the same problem.
Downgrading to
6.0.2
fixes the issue (I haven’t tried6.0.3
).This issue may have been introduced by #1808.
@romain-faust The issue is probably caused by that pull request, and maybe even these lines. Thank you for providing me with this information, I will try to downgrade version by version and see which one works for me.
Same problem here with Expo SDK 32.
I tried to upgrade to 6.04 and downgrade to 5.11.1, to clean every piece of cache, to create a new project and copy the files… Nothing worked.
I initially did not change any code, this just started malfunctionning by its own.
@QuintonC Thanks, but it did not help.
As a workaround, I set “window” object to “undefined” before calling firestore until this bug fixed, sounds bad but it seems working now.
At least I can continue to develop for today.
componentDidMount() { window = undefined; let db = firebase.firestore(); ...
For me the issue occurred once I updated to the newest expo client app today.
Expo released Expo Web with version 33 the other day. I haven’t taken a closer look but I believe they needed to introduce some kind of window object which sounds closely related with what @mikelehen said. Nice input btw 🙂
I checked and
window
is defined in my app. Going to unset it for now.Anyone planing to use expo-web in near future? Since window seems to be not fully functional I guess the issue rather is on expo’s instead of firebase’ side
Two options for near future I guess:
a) Expo only sets
window
for web environmentb) We take care of it ourselves with something like:
@mikelehen Thanks for your help. Full error message on my machine:
@yannickschuchmann Your solution helps to make firestore working but unfortunately causes an error within Expo app on iOS as it tries to create a new instance of window.WebSocket (which is undefined then) in method connectToDevTools. Do you have the same problem?
We expect this to be fixed in the next JS SDK release.