-
Notifications
You must be signed in to change notification settings - Fork 357
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug report
Describe the bug
After updating supabase from 2.67 to 2.72 the createClient function in edge functions (documented here) fails locally. Still works in production though.
By failing here is the console error message: TypeError: Key for the ES256 algorithm must be of type CryptoKey. Received an instance of Uint8Array.
To reproduce
- Start a local docker version of supabase 2.72 or later
- Try creating a supabase client like so:
export const supabaseAdmin = createClient(
Deno.env.get("SUPABASE_URL") || "",
Deno.env.get("SUPABASE_SERVICE_ROLE_KEY") || ""
)
const getSupabaseUserClient = (request: Request) =>
createClient(
Deno.env.get("SUPABASE_URL") || "",
Deno.env.get("SUPABASE_ANON_KEY") || "",
// Create client with Auth context of the user that called the function.
{
global: {
headers: { Authorization: request.headers.get("Authorization") },
},
}
)
Deno.serve(async (request: Request) => {
getSupabaseUserClient(request)
supabaseAdmin()
})
- run the function and you should have the error
My guess is that the default provided environment variables like SUPABASE_SERVICE_ROLE_KEY or SUPABASE_ANON_KEY have been updated but are now not compatible with supabase-js.
I've also seen a new documentation here but it does not seem to talk about impersonated clients.
Might be related to supabase/supabase#42037
kallebysantosMisterQH and stefan-girlich
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working