Skip to content
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

HeartbeatService throws error ONLY on Safari (IndexedDB issue?) #6871

Closed
OrhanTozan opened this issue Dec 9, 2022 · 7 comments · Fixed by #7272
Closed

HeartbeatService throws error ONLY on Safari (IndexedDB issue?) #6871

OrhanTozan opened this issue Dec 9, 2022 · 7 comments · Fixed by #7272

Comments

@OrhanTozan
Copy link

OrhanTozan commented Dec 9, 2022

[REQUIRED] Describe your environment

  • Operating System version: macOS 13.0.1
  • Browser version: Safari 16.1
  • Firebase SDK version: 9.15.0 (compat version, not modular)
  • Firebase Product: app

[REQUIRED] Describe the problem

When starting my Firebase app up in Safari, I get the following error:

It has to do with the HeartBeatService

image

I went on research and got the following findings:

So my bet: it is an issue with IndexedDB on Safari

@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@OrhanTozan OrhanTozan changed the title HeartbeatService throws error on Safari (IndexedDB issue?) Dec 9, 2022
@hsubox76
Copy link
Contributor

hsubox76 commented Dec 9, 2022

Thanks for the detailed report. I'm not able to reproduce it on Safari 16.1. This is the sample app I am using (compat app and auth):

import firebase from "firebase/compat/app";
import 'firebase/compat/auth';

firebase.initializeApp(/** my config **/);
firebase.auth().onAuthStateChanged(user => console.log('user', user ? user.uid : 'no user'));

firebase.auth().signInAnonymously();

I also tried with modular, and wasn't able to reproduce it either.

Is there anything I should add to the code to trigger the error, or is there anything special about the Safari environment (iframe, privacy settings)?

Is there a firebase-heartbeat-database in the browser's indexedDB? (Can find it in the Storage tab of the Safari dev console). If so, does deleting it make the problem go away?

@OrhanTozan
Copy link
Author

OrhanTozan commented Dec 10, 2022

@hsubox76

  • There is a firebase-heartbeat-database indexedDB, but it has no rows: image
  • I can't reproduce the issue when launched in a Safari Private Window. If that's the case, you would think that emptying the caches from a normal Window would fix the issue, but no... Develop -> Empty Caches doesn't resolve the issue.
  • I can't reproduce it on https://fir-ui-demo-84a6c.firebaseapp.com
  • The site where I am reproducing it, is: what.how. Perhaps you can try reproducing it there?
@OrhanTozan
Copy link
Author

I think it might only occur when you have Crisp chat in your web app.

@mmmulani
Copy link

we have a bunch of reports of this issue.

@hsubox76 it doesn't seem to be a consistent issue though, users have reported that restarting Safari fixes the problem

in that case, it would be nice if firebase caught/exposed the issue somehow to the application? Just so that we can recover from it in a nicer fashion

@hsubox76
Copy link
Contributor

Sure, I may be able to add a catch to

Do you think it would be all right to have it console.log the error if it catches it? I do want to make sure it's surfaced and not swallowed, but I don't want to clutter Sentry logs with console.error or console.warn. Is console.log ok? I think console.debug is too invisible (the user would have to deliberately turn debug logging on).

@mmmulani
Copy link

console.log is definitely fine, and even console.error could be good to be honest, since this could end up being somewhat fatal?

thanks for the fast response btw!

@firebase firebase locked and limited conversation to collaborators Jun 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
5 participants