fix(admin-api): give route handlers the context argument Next.js requires

Merged
KM
5d ago
+9-5

Fixes the failed Railway build after #499: next build rejects route handlers whose second argument is optional (Expected "RouteContext", got "undefined"). The typecheck and tests don't run this check; only the production build does.

  • adminApiRoute now takes context: { params: Promise<Params> } (required), as Next.js 15 expects.
  • The API test passes the context.

Verified locally: pnpm build:editor && pnpm build:web passes (29/29 pages), typecheck clean, 344 unit / 23 tRPC / 49 API tests pass.

Follow-up: add the production build to the web CI workflow so this class of error fails CI.

Ask Polylane for an impact assessment of this pull request:

Assess with Polylane


Summary by cubic

Fixes the failed Railway build: Next.js 15 requires route handlers to accept a required context argument, so the optional second parameter in adminApiRoute broke next build even though typecheck and tests passed.

  • adminApiRoute now requires context: { params: Promise<Params> }.
  • The admin feedback API test now passes a resolved context to route handlers.
  • Verified locally: builds pass, typecheck clean, and all 344 unit / 23 tRPC / 49 API tests pass.

Follow-up: add the production build to the web CI workflow so this class of error fails CI.