← All errors · SupabaseSupabase auth errors
@supabase/server adapters removed Dec 1 (Hono, H3, Elysia, NestJS): migrate without turning 401 into 200
What you see
The four framework adapters inside @supabase/server (@supabase/server/adapters/hono, /adapters/h3, /adapters/elysia, /adapters/nestjs) still work today and will be removed from the package on December 1, 2026. Supabase's changelog and docs do not quote an error message for the removal, so this page does not either. The adapter source already marks withSupabase with a JSDoc @deprecated tag: "Removed on December 1, 2026. Use the Hono bridge from the framework integration guide instead", so your editor shows it struck through. The dangerous failure is silent: if you migrate an auth: 'user' endpoint onto withClaims() instead of withRequiredClaims(), an anonymous request that used to get 401 now gets 200, with no error and no log.
What it means
Supabase deprecated the Hono, H3, Elysia and NestJS adapters in @supabase/server (change type Deprecation, sunset date 2026-12-01, self-hosted not affected). No new adapters are accepted. Nothing else changes: withSupabase(config, handler) is not deprecated, nor is its entry form withSupabase(config), nor any @supabase/server/middleware/* entry. The replacement is a bridge: one file you copy into your project that runs a @supabase/middleware entry array inside your framework's own middleware slot. The adapters rejected unauthenticated requests. withClaims() does not: it rejects a token that is present and invalid, but a request with no credentials at all contributes jwtClaims: null and falls through, by design. Nothing throws and nothing logs. The endpoint returns 200 with whatever Row Level Security lets the anonymous role see, often an empty array, which reads like a data bug and can sit in production for a long time. withRequiredClaims() rejects before your handler runs and contributes non-null jwtClaims. The two are mutually exclusive: both declare the jwtClaims key, so composing them is a compile-time conflict.
Likely causes
- You still import from @supabase/server/adapters/hono, h3, elysia or nestjs, and the package will stop shipping them on Dec 1, 2026.
- You replaced an auth: 'user' (or bare withSupabase()) registration with withClaims() instead of withRequiredClaims(), so anonymous requests now get 200.
- You renamed userClaims to jwtClaims in bulk. The field names differ, and in plain JavaScript jwtClaims.id is undefined with no error.
- You tried to hand-roll a check for an auth: 'publishable' or auth: 'secret' endpoint. There is no composable gate for those two modes; they stay on withSupabase.
- You use pnpm or another strict package manager and did not add @supabase/middleware as a direct dependency.
How to fix it
Check versions. The bridges need @supabase/server 1.6.0 or later and Node 22 or later. withRequiredClaims shipped in 1.5.1 and the entry form of withSupabase in 1.6.0; releases before 1.5.1 have no /middleware/* exports.
npm ls @supabase/server # 1.6.0 or later node --version # 22 or laterInventory every adapter registration before you edit anything. The auth value lives in the adapter config, not in the handler, and stops being visible once you start swapping imports. Write down each withSupabase(...) call and its auth value. A bare withSupabase() counts as auth: 'user'.
grep -rn "@supabase/server/adapters" src/Decide the replacement for each auth value. auth: 'user' (or no config) becomes withRequiredClaims(). auth: 'none' needs no gate. auth: 'publishable' and auth: 'secret' have no composable gate: keep those endpoints on withSupabase({ auth: 'publishable' }) or withSupabase({ auth: 'secret' }), which needs no changes. Do not use withClaims() here.
// auth: 'user', or no config toHono([withRequiredClaims(), withSupabaseClient()]) // auth: 'none' toHono([withSupabaseClient()]) // auth: 'publishable' or auth: 'secret' // Stop. Keep withSupabase for this endpoint.Add @supabase/middleware as a direct dependency (the bridge imports it, and a strict package manager does not let your code import a transitive dependency), then copy the bridge for your framework as is, comments included. For H3, Elysia or NestJS replace hono in the URL with h3, elysia or nestjs (the NestJS file is nestjs/supabase.guard.ts, saved as src/lib/supabase.guard.ts).
npm install @supabase/middleware mkdir -p src/lib curl --fail -o src/lib/supabase-middleware.ts \ https://raw.githubusercontent.com/supabase/server/main/examples/frameworks/hono/supabase-middleware.tsSwap the registration. This is the wrong version next to the right one (Hono, from Supabase's guide). The wrong one compiles, passes the typecheck, and lets anonymous callers in.
// WRONG (silent 401 -> 200) // Before: an anonymous request gets 401 and the handler never runs. app.use('*', withSupabase({ auth: 'user' })) // After, wrong: an anonymous request gets 200. The handler runs with // jwtClaims === null and an unauthenticated Supabase client. app.use('*', toHono([withClaims(), withSupabaseClient()]))The right version: the same gate the adapter applied. Add withSupabaseAdminClient() from @supabase/server/middleware/admin-client only where the old code read supabaseAdmin (it needs the secret key).
// BEFORE import { withSupabase } from '@supabase/server/adapters/hono' app.use('*', withSupabase({ auth: 'user' })) // AFTER, right: the same gate the adapter applied. import { withRequiredClaims } from '@supabase/server/middleware/required-claims' import { withSupabaseClient } from '@supabase/server/middleware/client' import { toHono } from './lib/supabase-middleware.js' app.use('*', toHono([withRequiredClaims(), withSupabaseClient()]))Hono. Chain .use() into the routes so the contributed keys type through c.var, and register the middleware before the routes it gates (a route added first runs with no gate and no error). A second entry array for other routes goes in its own sub-app mounted with app.route(). Keep the c.res clear-then-assign line and its comment in the bridge.
import { Hono } from 'hono' import { withRequiredClaims } from '@supabase/server/middleware/required-claims' import { withSupabaseClient } from '@supabase/server/middleware/client' import { toHono } from './lib/supabase-middleware.js' const app = new Hono() .use('*', toHono([withRequiredClaims(), withSupabaseClient()])) .get('/todos', async (c) => { const { data, error } = await c.var.supabase.from('todos').select() if (error) return c.json({ error: error.message }, 500) return c.json(data) }) .get('/me', (c) => c.json({ id: c.var.jwtClaims.sub })) export default { fetch: app.fetch }H3 / Nuxt. event.context is not generic, so hoist the entry array to a const and read the keys through Contributions<typeof entries>. To gate only one path, use app.use('/path', toH3(entries)) before the routes under it.
import { H3 } from 'h3' import type { Contributions } from '@supabase/middleware' import { withRequiredClaims } from '@supabase/server/middleware/required-claims' import { withSupabaseClient } from '@supabase/server/middleware/client' import { toH3 } from './lib/supabase-middleware.js' const entries = [withRequiredClaims(), withSupabaseClient()] as const const app = new H3() app.use(toH3(entries)) app.get('/todos', async (event) => { const { supabase } = event.context as Contributions<typeof entries> const { data, error } = await supabase.from('todos').select() if (error) throw error return data }) export default { fetch: app.fetch }Elysia. wrapElysia composes the entries around app.handle and supabaseCtx() hands the context to your routes. They work only as a pair: if you serve the app with app.listen() or export default app, the entries never run and supabaseCtx() throws on every route. Because the entries wrap the whole app, a second array for other routes needs its own Elysia instance, wrapped separately.
import { Elysia } from 'elysia' import { withRequiredClaims } from '@supabase/server/middleware/required-claims' import { withSupabaseClient } from '@supabase/server/middleware/client' import { supabaseCtx, wrapElysia } from './lib/supabase-middleware.js' const entries = [withRequiredClaims(), withSupabaseClient()] as const const app = new Elysia() .use(supabaseCtx<typeof entries>()) .get('/todos', async (c) => { const { data, error } = await c.supabase.from('todos').select() if (error) throw error return data }) export default { fetch: wrapElysia(entries, (req) => app.handle(req)), }NestJS. Call toNestGuard once and reuse the class on every @UseGuards(). A guard covers context and short-circuit but not the response phase, so leave withCors out of the guard array and use app.enableCors(). The bridge builds a Web Request from Nest's request with headers and method only; the body is not forwarded, so put signature checks or body audits in Nest middleware. Running the example needs swc, ts-node or a build step because of the decorators, and Nest answers a POST with 201 by default.
import { Controller, Get, Req, UseGuards } from '@nestjs/common' import type { Contributions } from '@supabase/middleware' import { withRequiredClaims } from '@supabase/server/middleware/required-claims' import { withSupabaseClient } from '@supabase/server/middleware/client' import { toNestGuard } from './lib/supabase.guard.js' const entries = [withRequiredClaims(), withSupabaseClient()] as const const SupabaseGuard = toNestGuard(entries) @Controller('todos') export class TodosController { @Get() @UseGuards(SupabaseGuard) async list(@Req() req: Contributions<typeof entries>) { const { data, error } = await req.supabase.from('todos').select() if (error) throw error return data } }Rewrite the call sites. The adapters exposed one nested supabaseContext object; the entries contribute flat keys. No entry contributes userClaims. jwtClaims is the raw JWT payload, so the field names change: userClaims.id becomes jwtClaims.sub, .role stays .role, .email stays .email, .appMetadata becomes .app_metadata, .userMetadata becomes .user_metadata. Rewrite each read individually. A blanket rename fails to compile in TypeScript, and in plain JavaScript jwtClaims.id is undefined with no error.
c.var.supabaseContext.supabase -> c.var.supabase c.var.supabaseContext.supabaseAdmin -> c.var.supabaseAdmin c.var.supabaseContext.userClaims.id -> c.var.jwtClaims.sub # H3: event.context.supabaseContext.supabase -> event.context.supabase # NestJS: req.supabaseContext.supabase -> req.supabase grep -rn "supabaseContext" src/ # expect no resultsVerify in this order. First the typecheck. Second, and this is the check that matters: for every endpoint your inventory recorded as rejecting, prove it still returns 401 with no token. A 200 on the first call means the gate is missing. A clean typecheck says nothing about it. Then run your tests. The rejection body changed even where the status did not (see the next step).
npx tsc --noEmit BASE=http://localhost:3000 # no credentials -> expect 401 curl -s -o /dev/null -w "%{http_code}\n" $BASE/your-endpoint # a valid user token -> expect 200 curl -s -o /dev/null -w "%{http_code}\n" \ -H "Authorization: Bearer $TOKEN" $BASE/your-endpointRecheck any client that parses the error body. withRequiredClaims answers with the standard error payload: no Authorization header gives 401 MISSING_CREDENTIALS; an sb_* API key in the Authorization slot gives 401 UNUSABLE_CREDENTIAL; a token that fails verification gives 401 INVALID_JWT; a token when the JWKS could not be fetched gives 500 JWKS_FETCH_FAILED; a token with no JWKS source and no usable project URL gives 500 JWKS_NOT_CONFIGURED. The adapters emitted none of these: Hono threw an HTTPException (text/plain, no code), H3 threw an HTTPError, Elysia surfaced a SupabaseError through onError, and only NestJS threw HttpException({ message, code }, status). A client that branches on the 401 status is fine.
Browser callers and env errors. Neither withClaims nor withRequiredClaims answers a CORS preflight, and their short-circuits carry no CORS headers, so compose withCors from @supabase/middleware/cors ahead of the gate (on NestJS use app.enableCors() instead). withSupabaseClient() and withSupabaseAdminClient() throw an EnvError when configuration is missing, and the bridges do not catch it, where the adapters turned it into a clean 500. Map it in your framework's error boundary.
Clean up. Re-run the grep. Anything left should be an endpoint you kept on purpose (the publishable and secret cases stay on withSupabase, which is not deprecated). If an endpoint is already a plain fetch handler, staying on withSupabase() is a legitimate end state. Supabase's guide also includes a prompt you can hand to a coding agent for this migration.
grep -rn "@supabase/server/adapters" src/
Still stuck after trying this? Get it fixed for $49, or you don't pay.
Prevent this next time
- Configure custom SMTP before launch so auth emails are not limited by the built-in test sender.
- Test signup, login, password reset and email confirmation on a staging project after every auth change.
FAQ
What does "@supabase/server adapters removed Dec 1 (Hono, H3, Elysia, NestJS): migrate without turning 401 into 200" mean?
Supabase deprecated the Hono, H3, Elysia and NestJS adapters in @supabase/server (change type Deprecation, sunset date 2026-12-01, self-hosted not affected). No new adapters are accepted. Nothing else changes: withSupabase(config, handler) is not deprecated, nor is its entry form withSupabase(config), nor any @supabase/server/middleware/* entry. The replacement is a bridge: one file you copy into your project that runs a @supabase/middleware entry array inside your framework's own middleware slot. The adapters rejected unauthenticated requests. withClaims() does not: it rejects a token that is present and invalid, but a request with no credentials at all contributes jwtClaims: null and falls through, by design. Nothing throws and nothing logs. The endpoint returns 200 with whatever Row Level Security lets the anonymous role see, often an empty array, which reads like a data bug and can sit in production for a long time. withRequiredClaims() rejects before your handler runs and contributes non-null jwtClaims. The two are mutually exclusive: both declare the jwtClaims key, so composing them is a compile-time conflict.
What usually causes it?
You still import from @supabase/server/adapters/hono, h3, elysia or nestjs, and the package will stop shipping them on Dec 1, 2026. You replaced an auth: 'user' (or bare withSupabase()) registration with withClaims() instead of withRequiredClaims(), so anonymous requests now get 200. You renamed userClaims to jwtClaims in bulk. The field names differ, and in plain JavaScript jwtClaims.id is undefined with no error. You tried to hand-roll a check for an auth: 'publishable' or auth: 'secret' endpoint. There is no composable gate for those two modes; they stay on withSupabase. You use pnpm or another strict package manager and did not add @supabase/middleware as a direct dependency.
How do I fix it?
1. Check versions. The bridges need @supabase/server 1.6.0 or later and Node 22 or later. withRequiredClaims shipped in 1.5.1 and the entry form of withSupabase in 1.6.0; releases before 1.5.1 have no /middleware/* exports. 2. Inventory every adapter registration before you edit anything. The auth value lives in the adapter config, not in the handler, and stops being visible once you start swapping imports. Write down each withSupabase(...) call and its auth value. A bare withSupabase() counts as auth: 'user'. 3. Decide the replacement for each auth value. auth: 'user' (or no config) becomes withRequiredClaims(). auth: 'none' needs no gate. auth: 'publishable' and auth: 'secret' have no composable gate: keep those endpoints on withSupabase({ auth: 'publishable' }) or withSupabase({ auth: 'secret' }), which needs no changes. Do not use withClaims() here. 4. Add @supabase/middleware as a direct dependency (the bridge imports it, and a strict package manager does not let your code import a transitive dependency), then copy the bridge for your framework as is, comments included. For H3, Elysia or NestJS replace hono in the URL with h3, elysia or nestjs (the NestJS file is nestjs/supabase.guard.ts, saved as src/lib/supabase.guard.ts). 5. Swap the registration. This is the wrong version next to the right one (Hono, from Supabase's guide). The wrong one compiles, passes the typecheck, and lets anonymous callers in. 6. The right version: the same gate the adapter applied. Add withSupabaseAdminClient() from @supabase/server/middleware/admin-client only where the old code read supabaseAdmin (it needs the secret key). 7. Hono. Chain .use() into the routes so the contributed keys type through c.var, and register the middleware before the routes it gates (a route added first runs with no gate and no error). A second entry array for other routes goes in its own sub-app mounted with app.route(). Keep the c.res clear-then-assign line and its comment in the bridge. 8. H3 / Nuxt. event.context is not generic, so hoist the entry array to a const and read the keys through Contributions<typeof entries>. To gate only one path, use app.use('/path', toH3(entries)) before the routes under it. 9. Elysia. wrapElysia composes the entries around app.handle and supabaseCtx() hands the context to your routes. They work only as a pair: if you serve the app with app.listen() or export default app, the entries never run and supabaseCtx() throws on every route. Because the entries wrap the whole app, a second array for other routes needs its own Elysia instance, wrapped separately. 10. NestJS. Call toNestGuard once and reuse the class on every @UseGuards(). A guard covers context and short-circuit but not the response phase, so leave withCors out of the guard array and use app.enableCors(). The bridge builds a Web Request from Nest's request with headers and method only; the body is not forwarded, so put signature checks or body audits in Nest middleware. Running the example needs swc, ts-node or a build step because of the decorators, and Nest answers a POST with 201 by default. 11. Rewrite the call sites. The adapters exposed one nested supabaseContext object; the entries contribute flat keys. No entry contributes userClaims. jwtClaims is the raw JWT payload, so the field names change: userClaims.id becomes jwtClaims.sub, .role stays .role, .email stays .email, .appMetadata becomes .app_metadata, .userMetadata becomes .user_metadata. Rewrite each read individually. A blanket rename fails to compile in TypeScript, and in plain JavaScript jwtClaims.id is undefined with no error. 12. Verify in this order. First the typecheck. Second, and this is the check that matters: for every endpoint your inventory recorded as rejecting, prove it still returns 401 with no token. A 200 on the first call means the gate is missing. A clean typecheck says nothing about it. Then run your tests. The rejection body changed even where the status did not (see the next step). 13. Recheck any client that parses the error body. withRequiredClaims answers with the standard error payload: no Authorization header gives 401 MISSING_CREDENTIALS; an sb_* API key in the Authorization slot gives 401 UNUSABLE_CREDENTIAL; a token that fails verification gives 401 INVALID_JWT; a token when the JWKS could not be fetched gives 500 JWKS_FETCH_FAILED; a token with no JWKS source and no usable project URL gives 500 JWKS_NOT_CONFIGURED. The adapters emitted none of these: Hono threw an HTTPException (text/plain, no code), H3 threw an HTTPError, Elysia surfaced a SupabaseError through onError, and only NestJS threw HttpException({ message, code }, status). A client that branches on the 401 status is fine. 14. Browser callers and env errors. Neither withClaims nor withRequiredClaims answers a CORS preflight, and their short-circuits carry no CORS headers, so compose withCors from @supabase/middleware/cors ahead of the gate (on NestJS use app.enableCors() instead). withSupabaseClient() and withSupabaseAdminClient() throw an EnvError when configuration is missing, and the bridges do not catch it, where the adapters turned it into a clean 500. Map it in your framework's error boundary. 15. Clean up. Re-run the grep. Anything left should be an endpoint you kept on purpose (the publishable and secret cases stay on withSupabase, which is not deprecated). If an endpoint is already a plain fetch handler, staying on withSupabase() is a legitimate end state. Supabase's guide also includes a prompt you can hand to a coding agent for this migration.
Last checked against official docs on . Sources: Supabase changelog: Framework adapters in @supabase/server are deprecated, Supabase docs: Server: Frameworks (Moving off the adapters), supabase/server: adapters README (deprecation notice).
Related errors
- Invalid JWT / JWT expired
- Supabase select returns an empty array (no error)
- new row violates row-level security policy for table
More Supabase errors and fixes →
Tools that help
- Railway: Deploy backends and databases; new users get $20 credit.
Some links on this page are affiliate links: if you sign up or buy through them, FixStack may earn a commission at no extra cost to you. Learn more.
Get new fixes weekly
No spam. Unsubscribe anytime. Privacy