Next.js Discord

Discord Forum

Trying to deploy project to vercel

Unanswered
DrR0wlet posted this in #help-forum
Open in Discord
I'm deploying my app to vercel and I'm using node express for the server and next.js for client. When I run them both locally it works but vercel deployment is different. This is my first time deploying a full application, but like only the client can run and the server doesn't. I figured to ask here because I can't find a lot of doc's online that are very helpful/I think it might screw up my already working code if I try anything experimental. I
Here is my vercel.json: {
"version": 2,
"builds": [
{
"src": "webjournal/package.json",
"use": "@vercel/next"
},
{
"src": "server/server.js",
"use": "@vercel/node"
}
],
"routes": [
{
"src": "/api/(.)",
"dest": "/server/server.js"
},
{
"src": "/(.
)",
"dest": "/webjournal/$1"
}
]
}

and my server.js:

5 Replies

I deployed the server and client separately on vercel, the server gives me a error 500 and the client works but the routes with parameters give me a 404. to fix the server I did the whole rename it index.js and put it in a folder called api or whatever but that didn't work when I was deploying it.
Spectacled bear
If I understood correctly, you are running two separate projects. One is Next.js client-side and one is a Node.js backend project. If that is the case, you'd have deployed it separately in Vercel. How have you deployed it to vercel?
Spectacled bear
Oh okay, you've set up monorepo. BTW I cannot view your deployment on Vercel.