supabase: Can't sign up users NextJS. Getting invalid claim: missing sub claim

Bug report

Describe the bug

When using signUp I get an 401 error: invalid claim: missing sub-claim error

To Reproduce

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

const { error } = await supabase.auth.signUp({
      email: data.email,
      password: data.password,
      options: {
        data: {
          username: data.username
        }
      }
    })

Expected behavior

The user is added to the authentication table and can signIn

System information

  • OS: Ubuntu 20.4
  • Version of supabase-js: ^2.11.0

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 8
  • Comments: 17 (1 by maintainers)

Most upvoted comments

I’m having the exact same issue on my project. Signing in for the first time works fine, but after logging out and trying to log in again the server responds with 401: missing sub claim. Works fine locally but as soon as I deploy it somewhere it breaks.

FYI I replaced auth implementation into the one from NextJS examples, to handle sign in via /app/auth/callback/route, like in here: https://github.com/vercel/next.js/tree/canary/examples/with-supabase and now its working fine, but the original example is not working, indeed.

To ensure all of this in configured properly, I recommend running this command as a starting point, as it has all the server-side auth and cookies stuff setup already! 🚀

npx create-next-app -e with-supabase

When I commented on this issue five months ago, I had tried exactly that and it did not work. 😅

No one on my team has tried since though, as we had to choose a tool other than Supabase because of this. 😭

same issue here, weird thing that SOMETIMES it works… Is thats really still has no reaction/solution?