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.83k stars 219 forks source link

supabaseAuthClient.auth.getUser not working on v2.42.5 #1025

Closed yunpaik closed 1 week ago

yunpaik commented 1 week ago

Bug report

Describe the bug

When calling await supabaseAuthClient.auth.getUser() in the edge function, the following error is returned even though the correct jwt token was provided.

{
  data: { user: null },
  error: AuthSessionMissingError: Auth session missing!
    at https://esm.sh/v135/@supabase/auth-js@2.63.1/esnext/auth-js.mjs:2:29430
    at _._useSession (https://esm.sh/v135/@supabase/auth-js@2.63.1/esnext/auth-js.mjs:2:27513)
    at eventLoopTick (ext:core/01_core.js:64:7)
    at async _._getUser (https://esm.sh/v135/@supabase/auth-js@2.63.1/esnext/auth-js.mjs:2:29103)
    at async https://esm.sh/v135/@supabase/auth-js@2.63.1/esnext/auth-js.mjs:2:28966 {
    __isAuthError: true,
    name: "AuthSessionMissingError",
    status: 400,
    code: undefined
  }
}

This issue only happens on v2.42.5. The same code works perfectly fine on v.2.42.4.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Run await supabaseAuthClient.auth.getUser() in the edge function with correct jwt token

Expected behavior

I should be able to get user session without any issue

christophemenager commented 1 week ago

I confirm I have searched the Docs, GitHub Discussions, and Discord.

Really? :)

Duplicate of:

GaryAustin1 commented 1 week ago

Going to leave this open for now (even though duplicate) as for some reason the fix made in auth-js has not been released here in supabase-js.

This issue is impacting users of edge functions still currently.

kangmingtay commented 1 week ago

We've made the fix in #1029 so it should be available in supabase-js v2.42.7, thanks for reporting this!