AlphaOptionalconfig: WithSupabaseAdminClientConfigindex.EnvError When SUPABASE_URL or the secret key is
missing — thrown at the first ctx.supabaseAdmin property access, inside
the handler or downstream middleware that performs it.
import { pipeline } from '@supabase/middleware'
import { withSupabaseAdminClient } from '@supabase/server/middleware/admin-client'
export default {
fetch: pipeline([withSupabaseAdminClient()], async (req, ctx) => {
await ctx.supabaseAdmin.from('audit_log').insert({ action: 'ping' })
return Response.json({ ok: true })
}),
}
The composable middleware surface tracks @supabase/middleware 0.x — entry
shapes, context keys, and config options may change between 0.x releases.
Alpha. Contributes
ctx.supabaseAdmin— an admin Supabase client that bypasses Row-Level Security, authenticated with a secret key. This is the same middlewarewithSupabasecomposes internally to build its context.The client is constructed on the first property access of
ctx.supabaseAdminand memoized for the request. A handler that never accesses it requires no secret key.