supabase-js icon indicating copy to clipboard operation
supabase-js copied to clipboard

Acquiring an exclusive Navigator LockManager failed

Open supersu-man opened this issue 1 year ago • 70 comments

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

  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

  • 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.

supersu-man avatar Jan 02 '24 08:01 supersu-man

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

Klunk75 avatar Jan 06 '24 13:01 Klunk75

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

supersu-man avatar Jan 06 '24 21:01 supersu-man

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

hf avatar Jan 16 '24 12:01 hf

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.

supersu-man avatar Jan 25 '24 14:01 supersu-man

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"
    }
  },

dimeloper avatar Feb 18 '24 18:02 dimeloper

seeing this with supabase 2.39.7, angular 17.2.1

mikelhamer avatar Feb 22 '24 01:02 mikelhamer

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.

linhub15 avatar Feb 23 '24 18:02 linhub15

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

danielehrhardt avatar Mar 23 '24 21:03 danielehrhardt

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 avatar Mar 29 '24 14:03 vv001

@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"
  }
}

matheo avatar Mar 30 '24 06:03 matheo

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

vv001 avatar Mar 30 '24 07:03 vv001

@matheo your solution worked for me, thanks!

ibarraandre98 avatar Mar 31 '24 19:03 ibarraandre98

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

aroman25 avatar Apr 21 '24 21:04 aroman25

@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

wszgrcy avatar Apr 22 '24 14:04 wszgrcy

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

matheo avatar Apr 23 '24 05:04 matheo

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.

ThirzaNL avatar Apr 23 '24 16:04 ThirzaNL

@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

aroman25 avatar Apr 25 '24 00:04 aroman25

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

t1m4lc avatar May 10 '24 00:05 t1m4lc

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

woutersteven avatar May 10 '24 00:05 woutersteven

Any update on it?

I have "@supabase/supabase-js": "^2.43.4" and auth-js is 2.64.2 and still having that issue:

image

nicetomytyuk avatar Jun 04 '24 10:06 nicetomytyuk

I have the same problem with supabase-js 2.43.5 and angular 18.0.5

macgors avatar Jun 23 '24 16:06 macgors

@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"
    }
  },

francocores avatar Jul 12 '24 06:07 francocores

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 avatar Jul 26 '24 03:07 mungo-pod

@mungo-pod See this comment above, the override needs to be on "@supabase/auth-js" now.

rileythomp avatar Jul 26 '24 15:07 rileythomp

I still have not been able to resolve this using Yarn. latest versions of both

RyannGalea avatar Aug 03 '24 01:08 RyannGalea

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

wszgrcy avatar Aug 08 '24 11:08 wszgrcy

Any plans on fixing this issue in near future?

TRUSTMEIMJEDI avatar Aug 11 '24 22:08 TRUSTMEIMJEDI

I am using Angular 18 and the issue still persist even after trying to fix using the above recommendations

machariaz avatar Aug 13 '24 09:08 machariaz

@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"
  }
}

this temporary solution worked for me

  • angular 18.1.3
  • supabase-js 2.45.1

AlexisMelo avatar Aug 14 '24 17:08 AlexisMelo

FYI this is what resolved it for me with yarn.

  "resolutions": {
    "@supabase/auth-js": "2.61.0"
  }

RyannGalea avatar Aug 15 '24 11:08 RyannGalea