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

Fix unhandled rejection in Chromium #93

Open
micahjon opened this issue Dec 18, 2020 · 6 comments
Open

Fix unhandled rejection in Chromium #93

micahjon opened this issue Dec 18, 2020 · 6 comments

Comments

@micahjon
Copy link

Over the past few year, we've been seeing a steady trickle of errors in production due to the following line.

openreq.result.createObjectStore(storeName);

Error: Cannot read property 'createObjectStore' of undefined

It only occurs in Chromium browsers (Chrome, Edge Chromium, Opera), and almost exclusively on Windows & Chrome OS. We haven't been able to replicate it, but it's happened to over 900 users by now.

Ideally it would just trigger a Promise rejection, but it doesn't appear to do that (in Sentry is shows up as an unhandled error even though we explicitly handle the Promise rejection).

Would it be worth checking for openreq.result before calling createObjectStore()? Thanks!

@jakearchibald
Copy link
Owner

Do you use a custom store name, or custom database name?

@micahjon
Copy link
Author

Hmm, no, we just use the defaults:

import * as idbKeyval from 'idb-keyval';

// ...

this.store = new idbKeyval.Store();

@jakearchibald
Copy link
Owner

Are you still seeing this? I can't really explain it from looking at the spec, and haven't been able to reproduce it locally.

@micahjon
Copy link
Author

Yeah, unfortunately, it happens in production for us about 10-20 times a day (out of 100k users).

Screenshot from Sentry:
image

I looked at our logs and it appears that it only happens when a user switches tabs (from our tab to a different tab) while loading our app. So it's probably a side effect of Chrome reducing resources and throttling async tasks in background tabs.

As far as reproducing, it only occurs on Windows & Chrome OS--I don't see any bug reports for Mac.

@micahjon
Copy link
Author

@jakearchibald , would it be worth opening a Chromium issue for this (assuming it conflicts with the IndexedDB spec)? I understand your reluctance to add more code to this library for something that occurs so rarely and appears to be a browser quirk.

@jakearchibald
Copy link
Owner

Go for it. Although it's difficult to do anything about it without steps to reproduce the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants