supabase-community / auth-ui

Pre-built Auth UI for React
https://supabase.com/docs/guides/auth/auth-helpers/auth-ui
MIT License
478 stars 120 forks source link

Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'crypto.subtle.digest') in SocialAuth.svelte #206

Closed brunobely closed 11 months ago

brunobely commented 11 months ago

Bug report

Describe the bug

window.crypto.subtle is (sometimes?) undefined in mobile Safari, resulting in an error when trying to use social providers. In my production app, deployed on Vercel, things work as expected. In development mode, though, the following error is thrown:

Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'crypto.subtle.digest'): SocialAuth.svelte:21:85

I can't find any instances of crypto.subtle in @supabase/auth-ui, maybe it's one of its dependencies?

kishansripada commented 11 months ago

same issue in next.js on mobile chrome

silentworks commented 11 months ago

As that issue you linked to stated that iOS 10.2 and below doesn't support the standard SubtleCrypto which is what the @supabase/supabase-js library uses. You will have to use a polyfill in your project to get it working as we don't support non-standard crypto libraries.

brunobely commented 11 months ago

This still happens on iOS 16.6, so the OS version doesn't seem to be the issue. Also, like I said in the OP, it only happens in dev. I wonder if there's a polyfill that is installed during production build but isn't there in dev?