Nick Pritchyk
Nick Pritchyk

Reputation: 57

Why am I getting a Vercel deployment Next.js route error?

I am attempting to deploy my Next13 app on Vercel but I am receiving this error and I can't find out what the issue is referring to.

Type error: Route "app/api/signup/route.js" does not match the required types of a Next.js Route.
  "prisma" is not a valid Route export field.
Error: Command "npm run build" exited with 1

What could this mean?

Upvotes: 0

Views: 767

Answers (1)

teos
teos

Reputation: 437

App Router only allows HTTP methods and Route Segment Config in route.ts/js files.

Event before deploying to Vercel, npm run build should also show you this error

Unfortunately, you simply cannot export a custom key like export const prisma = ...
The only solution is to do that in a separate file, and import/export what you need from there


I actually started a discussion/PR that allows this. If that's still a pain point for you, maybe you can have a look and upvote it.

Upvotes: 1

Related Questions