-
-
Notifications
You must be signed in to change notification settings - Fork 559
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
How to handle network errors in the middle of createUser flow? #503
Comments
Hmmm interesting problem. Was there anything within the auth tab for that user (I.e. they were created, but there profile was not)? Your proposed solution does seems like a great approach for now, but it would be nice to figure out a way to handle it on the client. In theory you could In the longer term, this should probably be handled within react-redux-firebase, but we will have to come up with a of making that work. |
as a short term solution I implemented an onCreate function that copies the uid and email (it seems that this has happened to 0.5% of our users). This way even if the copy of the profile fails the user can continue to use the app. I want to test the following though. The .catch is catching the error on the .get() so we never actually come to the part that is responsible for updating the profile. If we change the .get() to onSnapshot, then we shouldn't get this error? And once we end up in .then() we could unsubscribe to onSnaptshot and execute our code further. Not sure if this will work - need to test it. |
@compojoom Love the idea! Let me know if you end up testing it out. As always, I'm open to a PR |
working on something else, but once I get some free time I'll test whether this works or not and create a PR |
I was greeted today by a bug report. The report was saying - user can't create anything.
I looked into the authentication page on firebase and grabbed the user's id. Then I went in firestore and tried to look his profile in the database - it was missing... That's impossible I thought - when we create a user, we have a profileFactory and it is responsible for writing to firestore. We save the email, uid, name etc in firestore.
Then I looked at our code and in the code of redux-firebase and realized that the only way this to happen is for the internet connection to be interrupted in the exact moment after logging in the user.
I tried to reproduce this and it turned out that I was correct.
here are the actions
I managed to cut out the internet connection right after firebase/LOGIN, then SET_PROFILE fails with unauthorized_error. The actual error code there is firestore/unavailable.
Any ideas how to recover from this (other than to have a stable internet connection :))?
is there an easy way around this problem? Right now what I am thinking about is giving up using createUser and writing a cloud function that receives all the data needed to register the user. Once the user is registered on the server, I can copy his data to the users collection & then I'll return a success to the app and the app could try to login with the email and password the user provided.
The text was updated successfully, but these errors were encountered: