supabase / auth-js

An isomorphic Javascript library for Supabase Auth.
MIT License
355 stars 160 forks source link

Error: Permission denied to access property "then" for Firefox Extensions #862

Open limdingwen opened 6 months ago

limdingwen commented 6 months ago

Bug report

Describe the bug

It doesn't seem to work in Firefox Extensions. Both Manifest v2 and v3 are tested.

This error is created:

Error: Permission denied to access property "then"

Please see screenshots for the stacktrace; I can't seem to copy it.

To Reproduce

const supabase = createClient(supabaseUrl, supabaseKey);

Expected behavior

It is initialized.

Screenshots

Screenshot 2024-03-13 at 2 15 47 AM

System information

Additional context

It seems to be something to do with Firefox's XRay Vision. I heard it works in Chrome extensions.

According to this old bug report:

That usually means that you're not creating the Promise out of the right window object. Eg. in chrome JS, don't pass a |new Promise()| to content, but get the window object for the page and do |new pageWindow.Promise()|

Probably something to do with globalThis?

limdingwen commented 6 months ago

I realise a possible issue is that I was running it in a content script, not a service worker.