supabase-js: Acquiring an exclusive Navigator LockManager failed
Bug report
- I confirm this is a bug with Supabase, not with my own application.
- 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.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 61
- Comments: 72 (4 by maintainers)
Commits related to this issue
- Added Prime Icons, Added override for supabase dependency due to Navigator LockManager Failed Error https://github.com/supabase/supabase-js/issues/936 — committed to mariorobles93/Card-Info-Angular by mariorobles93 3 years ago
- fix bug with supabase-js package more information about the bug - https://github.com/supabase/supabase-js/issues/936 — committed to didoslavov/cook-it by didoslavov 3 years ago
- override @supabase/auth-js dependency from v2.64.2 to v2.61.0 to resolve https://github.com/supabase/supabase-js/issues/936 — committed to rileythomp/jeopardy by rileythomp 2 years ago
- Updates (#116) * override @supabase/auth-js dependency from v2.64.2 to v2.61.0 to resolve https://github.com/supabase/supabase-js/issues/936 * update two way binding in profile visibility to work ... — committed to rileythomp/jeopardy by rileythomp 2 years ago
- feat: wrap navigator.locks.request with plain promise to help zone.js (#989) Wraps the `navigator.locks.request()` function with a plain Promise as libraries such as zone.js patch this object to tra... — committed to supabase/auth-js by hf 2 years ago
- Fixed supabase not working with help of https://github.com/supabase/supabase-js/issues/936#issuecomment-2691252604 — committed to vKekz/Link-Up by vKekz 2 years ago
- Run zone less https://github.com/supabase/supabase-js/issues/936#issuecomment-2751909607 https://stackoverflow.com/questions/79182192/setup-global-providers-for-angular-unit-tests https://justangular... — committed to 1maiprogram/website by hlovdal a year ago
@vv001 the override worked for me with
@supabase/supabase-js@2.40.0but for version2.41.1it seems thatgotruewas renamed toauthjsand then I updated the override and it worked!for
pnpm:and for
npmshould look like:Thank you @Klunk75 for the workaround.
For anyone who wants to fix it temporarily, add this below devDependencies in package.json
and run
npm iHi 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
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
It’s sad indeed, but Angular is not megaparsecs superior to React in almost every aspect. The verbosity of Angular is a big drawback imho. You have to double imports things such as components, enum and so on when you need to use them inside your components… You have to add to every component
standalone: truewhen you want to use them as “regular” component like in any modern framework (although that should not be true after v19). You have to add a selector name to every component. There is too many ways of doing things,styles, styleUrls, styleUrljust for styling a component whereas a single and standard way could be sufficient. Overall, I think the whole@Component()approach could be optional or removed and we could just replace it by a single render() method inside of classes… Furthermore, currently the framework is in a big transition which makes it hard for new programmer to learn it. The docs are not always up to date, they are some recommendations that should not be true anymore, they even made an RFC for that recently. And, for a very long time, the framework was RXJS oriented which is a big nonsense imho. It just adds a lot of complexity for no reasons in most cases. Fortunately, there is a shifting toward signals.So no, Angular is not megaparsecs superior to React in almost every aspect.
It’s sad to see most of the new players treating Angular as a second class citizen when it’s megaparsecs superior to React in almost every aspect
Why doesn’t the Supabase team address these issues? The problem has been ongoing for quite some time. I love Supabase, but I’m also a big fan of Angular. It’s disappointing that the Angular community doesn’t seem to be a priority for Supabase.
In case you use
pnpmas your dependency manager and you’re facing the same issue, you can fix it by adding the following in your package.json:FYI this is what resolved it for me with yarn.
I have the same problem with supabase-js 2.43.5 and angular 18.0.5
It may be useful for others, for me it is working for me on Angular
17.3.8andnpmwith the following inpackage.json:I just pasted what seemed relevant
seeing this with supabase 2.39.7, angular 17.2.1
I would also like this issue to get some love.
Ciao Davide, I’m using Supabase with an Ionic/Angular project and now it’s working with no errors and no issues. I’m using the latest version of all the frameworks (“@ionic/angular”: “8.4.1” - “@angular/cli”: “19.0.5” - “@supabase/supabase-js”: “2.47.10”) and removed Zone.js (using provideExperimentalZonelessChangeDetection in main.ts), and I don’t see this issue anymore.
Paolo
Same problem with Angular
17.3.0andpnpm, I don’t know why but I can’t solve the problem…even with overrides inpackage.jsonandrm -rf node_modules && rm -rf pnpm-lock.yaml && pnpm iuse
provideExperimentalZonelessChangeDetection()fixed the error for me ✌🏼This solved the issue for me.
I’m using the same version and workaround, I still see the error logged but the SDK still works to send/receive data from my database so I’m treating it more as a warning than an error for now.
I also tested going fully zoneless on my application which did indeed remove the error entirely (although quite a big refactor for a large codebase, so planning to do so slowly over time with the other workaround in place)
This is a nightmare bug to work with.
I am using Angular because I was familiar with it, even for SSR, I still use Angular. But the problem with all above now, since it has been siting for a long time, is that some of the key feature just can’t be used.
Anonymous Sign-In is a important functionality. But this temp fix disable the ability to use it.
"overrides": { "@supabase/supabase-js": { "@supabase/auth-js": "2.61.0" } }I hope that the temp fix doesn’t have to be rely upon for too long because it will hurt the longer you wait
Very annoying that this issue has been lying around for so long and is being ignored. Workaround could be to disable locking, but idk how big the side effects are.
this temporary solution worked for me
guys, thank you very much, we managed to solve the problem. to sum up:
in package.json:
in app.config.ts in appConfig var .providers add
provideExperimentalZonelessChangeDetection()removeprovideZoneChangeDetection({ eventCoalescing: true })in angular.json in polyfills mentions removed
"zone.js"at the end
npm iofcHi all, I solved removing Zone.js from my Angular project, moving to Zoneless change detection with the use of Signals. Here what I did:
I hope this can help! Kind regards,
Paolo
I’m using Supabase 2.47.10, and the problem persists.
What I can’t understand is if today it’s possible to use supabase with angular / ionic project or if this problem can produce bugs
Actually maybe one thing that could help is if we were to wrap the lock promise with the patched promise. I know that Dexie’s zone.js equivalent likes that.
Something like this: https://github.com/supabase/auth-js/pull/989
Yep, I understand why a lot of those “bad things” are still there, even though Angular has a strong focus on being backwards compatible that still does not make it megaparsecs superior to React in almost every aspect, come on…
I highly disagree on the take “long tailwind classes + state logic + props nightmare all in one file is terrible to maintain”. That’s why component are there. You can just decompose when it starts to be too big. And it’s not mandatory to put everything in one file or use tailwind, you can use css modules and put your css in another file if you prefer to do so (at least with NextJS). I still often myself not put everything into one file in Angular but this is mainly because it is long/verbose to create components in Angular and also because Angular is creating a supplementary tag every time you create a component, which makes styling afterwards more difficult and impact perf compared to other modern frameworks 😦
I agree that on some points they’re not comparable since they don’t have the same amount of features. It would be more fair to compare to a full fledge React framework such as NextJS. But the component authoring format can be compared and the React one is less verbose, at least for the creation of a basic component (without JSX and so on involved).
I don’t say Angular is shit and shouldn’t be used, in fact Angular becomes much better release after release, less verbose and more enjoyable to use. But saying that it is megaparsecs superior to React in almost every aspect is such a lie.
For anyone who still blocked by this issue, please prioritize it by submitting a ticket to supabase support in your projects dashboard. The longer we wait, the longer we are blocked by it
There’s someone yapping around.
Angular has put a strong focus on being backwards compatible. That’s why deprecated methods/fields still exist. standalone is not (yet) set to true by default for this reason.
The same applies to styleUrls and styleUrl. In react you have to add a library for every little thing. in the end you have a fat dependency on different maintainers.
a render() method? angular is very different from react because e.g. template and logic are separated for a good reason. look at the react components nowadays. long tailwind classes + state logic + props nightmare all in one file. terrible to maintain.
On a more neutral note, it is difficult to compare these two things. one is a framework and the other is a library (unless you are talking about e.g. nextjs)
But I also have to admit that as far as ssr is concerned, nextjs is clearly superior.
I am currently using the following solution to overcome this issue using Angular 18 with SSR, maybe it will help someone.
supabase.service.ts
auth.service.ts
app.component.ts
@mungo-pod See this comment above, the override needs to be on
"@supabase/auth-js"now.@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
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.
@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?