supabase-js
supabase-js copied to clipboard
Acquiring an exclusive Navigator LockManager failed
Bug report
- [x] I confirm this is a bug with Supabase, not with my own application.
- [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
Angular throws an error saying 'Acquiring an exclusive Navigator LockManager lock immediately failed'. This is a new angular project created with the angular version 17. The error is not shown in my other project which is created a month ago.
To Reproduce
- Create a new angular project and install '@supabase/supabase-js'
- Create environment files and add key and url of supabase.
- add
supabaseClient = createClient(environment.url, environment.key)to a component (app component)
Expected behavior
This error should not be thrown and should be able to use all the methods without errors.
Screenshots
System information
- OS: Windows
- Browser: Brave v1.61.109
- Version of supabase-js: 2.39.2
- Version of Node.js: 20.10.0
Additional context
Could be a duplicate of this issue from gotrue-js. Though I was able to signin using provider 'google' I wasn't able to retrieve session after I signin (throws an error saying Invalid API key) though my api keys and url are correct. I am assuming the error is with storage.
Hi there, I noticed the same problem. After some test I found that the issue should be related to the merge of this Pull Request in @supabase/gotrue-js version 2.62.0: https://github.com/supabase/gotrue-js/pull/807 If you try to downgrade @supabase/gotrue-js to version 2.61.0 (the previous one), the problem should disappear. Please Supabase Team can you check and try to solve this issue? Thank you!
Paolo
If you try to downgrade @supabase/gotrue-js to version 2.61.0 (the previous one), the problem should disappear.
Thank you @Klunk75 for the workaround.
For anyone who wants to fix it temporarily, add this below devDependencies in package.json
"overrides": {
"@supabase/supabase-js": {
"@supabase/gotrue-js": "2.61.0"
}
}
and run npm i
Is this error just being logged, or is it actually creating a problem for you?
Is this error just being logged, or is it actually creating a problem for you?
Sorry for the late reply. I don't think I am facing any issue, it's just the errors being logged.
In case you use pnpm as your dependency manager and you're facing the same issue, you can fix it by adding the following in your package.json:
"pnpm": {
"overrides": {
"@supabase/supabase-js>@supabase/gotrue-js": "2.61.0"
}
},
seeing this with supabase 2.39.7, angular 17.2.1
Seeing this with supabase 2.39.7 Reproduced with Chrome 121.0.6167.184 (Official Build) (64-bit) Reproduced with Safari 16.6 (18615.3.12.11.2) Unable to reproduce with Firefox 123.0 (64-bit).
// login.tsx
await supabase.auth.signInWithOAuth({
provider: "google",
});
// index.tsx
const session = await supabase.auth.getSession(); // session is null
Overriding gotrue-js to "2.61.0" fixed it.
If you try to downgrade @supabase/gotrue-js to version 2.61.0 (the previous one), the problem should disappear.
Thank you @Klunk75 for the workaround.
For anyone who wants to fix it temporarily, add this below devDependencies in package.json
"overrides": { "@supabase/supabase-js": { "@supabase/gotrue-js": "2.61.0" } }and run
npm i
maybe you can merge that
I have tried the override approach, with gotrue version 2.61.1 and version 2.54.2, but still keep getting the same error as in the original post.
Will this issue be resolved anytime soon or are there other alternatives to the workaround?
Using angular 17.0.7
@vv001 the override worked for me with @supabase/[email protected] but for version 2.41.1 it seems that gotrue was renamed to authjs and then I updated the override and it worked!
for pnpm:
"overrides": {
"@supabase/supabase-js>@supabase/auth-js": "2.61.0"
}
and for npm should look like:
"overrides": {
"@supabase/supabase-js": {
"@supabase/auth-js": "2.61.0"
}
}
Hi martheo, that did the trick. Thank you very much!
@matheo your solution worked for me, thanks!
@matheo - thanks! this worked for me and then I updated supabase for the signInAnonymously and now getting this error again, can you work your magic again for the latest @supabase/supabase-js 2.42.5?
@matheo - thanks! this worked for me and then I updated supabase for the signInAnonymously and now getting this error again, can you work your magic again for the latest @supabase/supabase-js 2.42.5?
same bug.....want use signInAnonymously.
I temporarily avoided this issue by using the ng18 zoneless mode
But zoneless is an experimental feature that may lead to other unknown issues
@aroman25 @wszgrcy weird because I just upgraded it and the same override worked for me :thinking:
in your lock file is there a @supabase/auth-js different than 2.61.0?
I had the same issue as @aroman25 and @wszgrcy , and I've solved it using a patch.
Let me preface by saying that I don't know the inner workings of Supabase at all, and I have not tested it thoroughly, so use it at your own risk.
Basically, it just removes the navigatorLock parts, as that's seemingly causing the error.
When using this, the override of the package version is no longer needed, besides pinning it to the patched version.
@wszgrcy - Yeah, that worked, also not a fan of it being experimental, but seems like v18 will have zoneless coming out next month
@matheo - 2.61.0 doesn't have the ability to signInAnonymously( )
@ThirzaNL - thanks, I'll wait for a fix, I can get by for now
Same problem with Angular 17.3.0 and pnpm, I don't know why but I can't solve the problem...even with overrides in package.json and rm -rf node_modules && rm -rf pnpm-lock.yaml && pnpm i
It may be useful for others, for me it is working for me on Angular 17.3.8 and npm with the following in package.json:
"dependencies": {
"@supabase/supabase-js": "2.43.1",
},
"devDependencies": {
"supabase": "^1.167.1",
},
"overrides": {
"@supabase/supabase-js": {
"@supabase/auth-js": "2.61.0"
}
},
I just pasted what seemed relevant
Any update on it?
I have "@supabase/supabase-js": "^2.43.4" and auth-js is 2.64.2 and still having that issue:
I have the same problem with supabase-js 2.43.5 and angular 18.0.5
@macgors maybe this could fix your problem
for me it's working on angular 18 with ssr but I need do a workaround on localhost (I'm not sure if this problem happens on https environment):
my service
@Injectable({
providedIn: 'root',
})
export class SupabaseService {
private supabase?: SupabaseClient
_session: AuthSession | null = null
constructor() {
this.createClient()
}
createClient() {
if (typeof window === 'undefined' || createClient === undefined) return
this.supabase = createClient(environment.supabaseUrl, environment.supabaseKey)
}
categories() {
return this.supabase?.from('angular_test_categories').select(`id, name`)
}
}
my package.json
"dependencies": {
...
"@angular/core": "^18.0.0",
"@angular/ssr": "^18.0.7",
...
"@supabase/supabase-js": "2.39.2",
},
"overrides": {
"@supabase/supabase-js": {
"@supabase/gotrue-js": "2.61.0"
}
},
Bumping, still can't get it to work even with overrides, Was on Angular 18 and downgraded to 17.3.8 per one of the comments above, but no luck. here's the loadout.
"dependencies": {
"@supabase/supabase-js": "2.39.2",
},
"devDependencies": {
"supabase": "^1.167.1",
},
"overrides": {
"@supabase/supabase-js": {
"@supabase/gotrue-js": "2.61.0"
}
}
@mungo-pod See this comment above, the override needs to be on "@supabase/auth-js" now.
I still have not been able to resolve this using Yarn. latest versions of both
Downgrading is a very bad approach Because the new version has new features and bug fixes We can temporarily downgrade to solve this problem But it's been several months now, and I think a formal repair should be carried out
Any plans on fixing this issue in near future?
I am using Angular 18 and the issue still persist even after trying to fix using the above recommendations
@vv001 the override worked for me with
@supabase/[email protected]but for version2.41.1it seems thatgotruewas renamed toauthjsand then I updated the override and it worked!for
pnpm:"overrides": { "@supabase/supabase-js>@supabase/auth-js": "2.61.0" }and for
npmshould look like:"overrides": { "@supabase/supabase-js": { "@supabase/auth-js": "2.61.0" } }
this temporary solution worked for me
- angular 18.1.3
- supabase-js 2.45.1
FYI this is what resolved it for me with yarn.
"resolutions": {
"@supabase/auth-js": "2.61.0"
}