AlphaOptionalconfig: WithSupabaseClientConfigindex.EnvError When SUPABASE_URL or the publishable key is
missing — composing wrappers (like withSupabase) map this to a 500
response; standalone pipelines see it as a thrown error.
import { pipeline } from '@supabase/middleware'
import { withSupabaseClient } from '@supabase/server/middleware/client'
export default {
fetch: pipeline([withSupabaseClient()], async (req, ctx) => {
const { data } = await ctx.supabase.from('posts').select('id, title')
return Response.json(data)
}),
}
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.supabase— a Supabase client scoped to the caller's identity, so Row-Level Security policies apply. This is the same middlewarewithSupabasecomposes internally to build its context.Standalone, the caller's Bearer token (when present) is attached unverified — PostgREST verifies it on every query. Compose middleware/claims!withClaims upstream when the pipeline itself needs verified claims.