Getting the following error on vercel deployment of this app: Creating an optimized…
- User
Getting the following error on vercel deployment of this app:
Creating an optimized production build ... Browserslist: browsers data (caniuse-lite) is 10 months old. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme Browserslist: caniuse-lite is outdated. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme ✓ Compiled successfully Linting and checking validity of types ... Failed to compile. src/app/api/register/init/route.ts Type error: Route "src/app/api/register/init/route.ts" does not match the required types of a Next.js Route. "sessions" is not a valid Route export field. Next.js build worker exited with code: 1 and signal: null Error: Command "npm run build" exited with 1
Assistant
The
sessionsMap is exported from aroute.tsfile, but Next.js Route Handlers can only export HTTP methods and special config fields. Move the shared state to a separate module.Assistant
Build succeeds. Two fixes applied:
-
src/app/api/register/init/route.ts— MovedsessionsMap and helpers to a separatesessions.tsmodule. Next.js Route Handlers can only export HTTP methods/config, not arbitrary variables likesessions. -
src/app/get-started/page.tsx— Refactored step indicator ternary to avoid TypeScript narrowing bug wherestep === 'done'became an impossible comparison afterstep === snarrowed the type.
-
- User
I'm getting the following error message in the knirv.com/register/key onboarding screen even though I already selected Enterprise to arrive at this point:
A enterprise key requires one of these subscription tiers: professional, enterprise, custom. Your current tier: none.
Assistant
Build passes. The issue was that the client-side
POSTto/api/register-keyatsrc/app/register/key/page.tsx:100never sent the Supabase session token, so the server'sgetUserTier()returned null. Fixed by importinguseAuth()and sendingAuthorization: Bearer ${user.accessToken}in the request headers.If the user is logged in via Supabase and has a subscription tier set, this will now resolve correctly. If the tier is missing from the database even after authentication, the
get_user_tierRPC call on the server side (src/app/api/register-key/route.ts:81) would be the next place to investigate.