Closed jens1101 closed 2 years ago
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Hi @jens1101, thanks for the report. Could you please share the SDK version, browser version and complete error logs that you're getting? Also, please follow the template when filling an issue, moving forward. Thanks!
@looptheloop88 I apologise for the missing information. I updated the Issue description with all the information I have. Please let me know if it's sufficient.
Hi @jens1101, thanks for providing the additional information. I appreciate it. I'm not really sure if this issue affects not only Analytics, but other Firebase products that use IndexedDB as well. Let me check and raise this matter with our engineers here and update this thread once I have any information to share.
I had a hard time filling the quota in order to reproduce your error exactly but I used a Firefox Private Window which also triggers indexedDB's request.onerror
and wasn't able to see the error. There's a try/catch in the analytics.isSupported()
method that wraps the validateIndexedDBOpenable()
from util/environment.ts that you linked above, which is successfully catching the error, for me.
This is consistently logging false
for me in the Firefox Private Window, which I've verified does trigger indexedDB's request.onerror
.
const isSupported = await firebase.analytics.isSupported();
console.log(isSupported);
I have a few questions:
1) How are you using analytics.isSupported()
in your code?
2) Can you paste the full text of the error in the console?
3) If you do your experiment with your case 2 and case 3 using a Firefox Private Window instead of by filling the quota, do you get the same results? Wondering if there's something special with the QuotaExceededError specifically.
@hsubox76 Thank you for your efforts! Please find below the answers to your questions:
Here is a snippet from our codebase:
export const initFirebase = async (firebaseConfig) => {
firebase.initializeApp(firebaseConfig);
let isSupported;
try {
isSupported = await firebase.analytics.isSupported();
if (isSupported) {
firebase.analytics();
}
} catch {
isSupported = false;
}
firebase.performance();
};
We are using a React app, this initialisation function gets called when our app is bootstrapped. I know that the try-catch block is technically not necessary, but we kept it there for safety.
When I run my test cases 2 and 3 in a private browser window on a virtual machine with enough storage then here is what I get in the console: Note that no error is logged to the console when the error handler returns true.
Additionally, here is a screenshot of my Firefox 48 console when I run our project in the same window (note that I had to redact some of the logs):
I test this by running a VirtualBox virtual machine with the following configuration:
I then downloaded the Firefox 48 files from here and run the firefox
executable. This is what I use for testing.
To fill up the hard drive space I do the following:
fallocate -l 10G large_file.img
. This will allocate as much disk space as possible. It will error out, but that's okay. You should now have the large_file.img
file in your home direcotry.df
to confirm that no free hard drive space is left.@hsubox76 Has there been any update on this? Is there anything else that you need from me?
Hi @jens1101 , Were you able to solve this issue ?
@iamashish121 No, unfortunately not. We decided to accept this as a possible error that users might encounter.
I can't currently reproduce this as it difficult to access the OS's in question and the Firefox version is older. I'm not seeing it in the current version of Firefox. Downgrading to Firefox 48, I was unable to get the current versions of the SDK to run, so I am guessing that you have to stick with some version of Firebase v8 in order to use it in this environment. Unfortunately we won't be adding any more updates to the v8 SDK, and any fix we found would be added to v9 going forward.
If anyone's having this issue with the v9 SDK, feel free to update. If it's with an older browser, let me know what you're doing to get v9 to work in the older browser (perhaps I'm missing something obvious).
@hsubox76 Thanks for the update. For me this bug only happens on Firebase v8 on Firefox v48, just as you described. Considering that you won't be adding any more updates to Firebase v8 then I think this issue can be closed.
Describe your environment
Describe the problem:
When the device's storage is full and I run the
isSupported
function from the Analytics package then I get aQuotaExceededError
logged to my console as an error.Steps to reproduce:
Case 1
firebase.analytics.isSupported()
QuotaExceededError
is logged to the consoleCase 2
indexedDB.open('foo').onerror = function () {}
QuotaExceededError
is logged to the consoleCase 3
indexedDB.open('foo').onerror = function () { return true }
Note: It seems that IndexedDB will only consider an error as "handled" if the error handler returns a truthy value.
Relevant Code:
This happens because the below handling function does not return a truthy value:
https://github.com/firebase/firebase-js-sdk/blob/ed4f95ceef98b4ae03864969c37f3232a00b7929/packages/util/src/environment.ts#L172-L174