supabase / supabase-js

An isomorphic Javascript client for Supabase. Query your Supabase database, subscribe to realtime events, upload and download files, browse typescript examples, invoke postgres functions via rpc, invoke supabase edge functions, query pgvector.
https://supabase.com
MIT License
2.86k stars 220 forks source link

Acquiring an exclusive Navigator LockManager failed #936

Open supersu-man opened 4 months ago

supersu-man commented 4 months ago

Bug report

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

  1. Create a new angular project and install '@supabase/supabase-js'
  2. Create environment files and add key and url of supabase.
  3. 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

Error

System information

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.

Klunk75 commented 4 months ago

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

supersu-man commented 4 months ago

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

hf commented 4 months ago

Is this error just being logged, or is it actually creating a problem for you?

supersu-man commented 3 months ago

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.

dimeloper commented 2 months ago

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"
    }
  },
mikelhamer commented 2 months ago

seeing this with supabase 2.39.7, angular 17.2.1

linhub15 commented 2 months ago

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

image

Overriding gotrue-js to "2.61.0" fixed it.

danielehrhardt commented 1 month ago

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

vv001 commented 1 month ago

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

matheo commented 1 month ago

@vv001 the override worked for me with @supabase/supabase-js@2.40.0 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"
  }
}
vv001 commented 1 month ago

Hi martheo, that did the trick. Thank you very much!

ibarraandre98 commented 1 month ago

@matheo your solution worked for me, thanks!

aroman25 commented 3 weeks ago

@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?

wszgrcy commented 3 weeks ago

@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

matheo commented 3 weeks ago

@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?

ThirzaNL commented 3 weeks ago

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.

aroman25 commented 3 weeks ago

@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

alcaidio commented 1 week ago

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

woutersteven commented 1 week ago

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