-
Notifications
You must be signed in to change notification settings - Fork 4
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
Console cannot write to IDB in Safari #46
Comments
I was able to recreate this in my safari on desktop. For me, it happens after typing email and clicking 'Authorize' but before clicking the link in the email that got sent. |
Ok I dug into this - it seems to be an unreported bug with saving Uint8Arrays in IndexedDB. I spent hours trying to figure out the apparent error (Safari says it can't find a value for the key attribute in the data we're saving, when it's very clearly there) and finally started digging in this direction when I noticed the error doesn't happen if we don't try to save delegations. Converting the Uint8Arrays in the delegations to ArrayBuffers makes the issue go away. The internet suggests that WebKit's handling of Uint8Arrays has been problematic - there's one bug I suspect may be related and generally Googling "indexeddb Uint8Array safari" paints a picture of a long history of poor support: https://bugs.webkit.org/show_bug.cgi?id=197050 This claims that "Storing ArrayBuffers in IndexedDB is very well supported": https://web.dev/articles/indexeddb-best-practices I'm inclined to move to storing ArrayBuffers in all cases and to add a bit of logic to convert existing Uint8Arrays to ArrayBuffers when we see them - anyone have any thoughts on that plan? |
we noticed that Safari users couldn't log in: storacha/console#46 I traced this down to a seemingly unreported WebKit bug where IndexedDB throws an error when saving Uint8Arrays in an object that uses inline-keys. I don't know these two things don't seem related, but there does seem to be some similar precedent: dexie/Dexie.js#656 (comment) This change tweaks `AgentData`'s export format to use `ArrayBuffer`s rather than Uint8Arrays, which should solve the issue. I was able to handle coercing back into Uint8Arrays pretty elegantly, and introduced a new `AgentDataImport` type to keep things typesafe.
we noticed that Safari users couldn't log in: storacha/console#46 I tracked this down to a seemingly unreported WebKit bug where IndexedDB throws an error when saving `Uint8Array`s in an object that uses inline-keys. I know these two things don't seem related, but there does seem to be some similar precedent: dexie/Dexie.js#656 (comment) This change tweaks `AgentData`'s export format to use `ArrayBuffer`s rather than `Uint8Array`s, which should solve the issue. I was able to handle coercing back into Uint8Arrays pretty elegantly, and introduced a new `AgentDataImport` type to keep things typesafe.
This is fixed! |
The text was updated successfully, but these errors were encountered: