-
Notifications
You must be signed in to change notification settings - Fork 483
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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
Creating an admin client with the new api keys fails.
To Reproduce
async function createAdminClient() {
return createClient<Database>(
process.env.NEXT_PUBLIC_SUPABASE_URL,
process.env.SUPABASE_SECRET_KEY,
{
auth: {
autoRefreshToken: false,
persistSession: false,
},
},
);
}
const adminClient = await createAdminClient();
await adminClient.auth.admin.createUser({
email,
password,
app_metadata: {
...metadata
},
});
Expected behavior
The user should be created.
Actual behavior
[next] at async signup (src/lib/supabase/actions.ts:32:22)
[next] 30 |
[next] 31 | try {
[next] > 32 | const { error } = await supabase.auth.admin.createUser({
[next] | ^
[next] 33 | ...data,
[next] 34 | app_metadata: {
[next] 35 | email,
[next] __isAuthError: true,
[next] status: 403,
[next] code: 'bad_jwt'
[next] }
System information
- Version of supabase-js: 2.57.4
Additional context
I believe that something goes wrong here: https://github.com/supabase/supabase-js/blob/cd8173e5564d44bb0241b1fd9cb4743618d5a441/src/SupabaseClient.ts#L300C1-L308C4 where the api key is inserted as authorization header fallback. This worked before, because the service_role_key actually was a valid JWT, but with the new api keys this fails.
foxted, crathor, RobbyUitbeijerse, jguepin, Marley-Mulvin-Broome and 6 more
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working