NextJS build works locally but fails when deployed to Vercel

I searched this up but found no solutions that applied. Vercel crying:
4 Replies
metalpipemomo
metalpipemomo2y ago
Proof it works locally
metalpipemomo
metalpipemomo2y ago
TS isnt complaining in the endpoint itself:
import { NextApiRequest, NextApiResponse } from 'next';
import { PrismaClient } from '@prisma/client';
import jwt from 'jsonwebtoken';

const prisma = new PrismaClient();

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const { username, email, password } = req.body as UserSignup;
const user = await prisma.user.create({
data: {
username,
email,
password,
},
});
const token = jwt.sign(user, process.env.PRIVATE_KEY);
res.status(201).json(token);
};

export default handler;
import { NextApiRequest, NextApiResponse } from 'next';
import { PrismaClient } from '@prisma/client';
import jwt from 'jsonwebtoken';

const prisma = new PrismaClient();

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const { username, email, password } = req.body as UserSignup;
const user = await prisma.user.create({
data: {
username,
email,
password,
},
});
const token = jwt.sign(user, process.env.PRIVATE_KEY);
res.status(201).json(token);
};

export default handler;
iDarkLightning
Are you running Prisma generate during your deploy
metalpipemomo
metalpipemomo2y ago
If I have to do that explicitly then I don't think I have Then I'm guessing I should throw that in as a prebuild step in package.json? Yeah that did the trick, thanks a bunch!
Want results from more Discord servers?
Add your server