-
Notifications
You must be signed in to change notification settings - Fork 893
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
Issue with version 9 compat build on Safari after one hour long sessions #5644
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
Thanks for reaching out. This definitely sounds like a bug. So just to clarify:
|
Thanks for the response. Yes, this only shows in Safari for macOS and iOS. Our user base in general is mostly using Chrome, but this error is only triggered for Safari users (and Chrome on iOS, which uses the Safari engine). Our app works in a way that signs the user in to Firebase automatically at the beginning using a custom token, and keeps that sign-in throughout the session. In case the user is logged out for any reason, we attempt a new sign-in using a new custom token. Actions are taken during the whole session, mostly Firebase storage uploads, but no additional auth action should need to happen on our end since the user is already signed in. We always check that the user is still signed in before any action using We will try to perform manual testing of this today, and we will also temporarily revert production to Firebase 8. |
I should add that we actually upgraded from |
We have now tested manually and after exactly one hour, all Storage and Firestore (the two services we use) operations stopped working, and the error mentioned above started to be thrown in the console. |
Thank you very much for the details. We will do some investigation |
9.1.3
compatauth
Description
Since updating from version 8.9.1 to the version 9.1.3 compatibility build, we started seeing lots of errors sent to our error tracker for Safari devices on sessions longer than one hour:
undefined is not an object (evaluating 'e._canInitEmulator=!1')
I believe this is the following line in the source code:
firebase-js-sdk/packages/auth/src/api/index.ts
Line 133 in 69ff8eb
The error is only triggered in Safari (macOS and iOS), and only for sessions longer than one hour. The error seems to be triggered on the first Firebase action after the one hour mark (our error reports range from just a few seconds after one hour, up to several minutes, and normal flow in our application is one Firebase action at least every 5 minutes). None of the error reports show a session duration shorter than one hour.
Note that it's not one hour idle, but rather with continuous Firebase actions every 3-5 minutes without any issues.
So, something must happen after specifically one hour, for instance the requirement of a refresh-token exchange the seems to fail. If I haven't misunderstood anything, this should be handled internally by the Firebase SDK. We are using a custom token to authenticate the session to begin with, but that happens immediately and one hour prior to the triggered errors. We do know that custom tokens has an expiration of one hour, but your docs clarify that this is unrelated in the following sentence and that the Firebase sessions should function longer (which it also always has done previously): Note: this only controls the time when the custom token itself expires. But once you sign a user in using signInWithCustomToken(), they will remain signed in into the device until their session is invalidated or the user signs out.
Steps to reproduce:
As far as we know
We had no similar problems with version 8, and we have not changed our code when transitioning to the compat build.
We are absolutely planning to migrate to the modular version of Firebase 9, but we have not been able to try that yet and we don't know if that would affect this problem.
Has any similar reports been sent, and do you immediately recognize the one hour "limit" for Safari sessions?
The text was updated successfully, but these errors were encountered: