Trying to deploy project to vercel
Unanswered
DrR0wlet posted this in #help-forum
DrR0wletOP
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:
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
DrR0wletOP
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 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?
DrR0wletOP
oh wait I'm supposed to have it separtely? I have it on the same project but yeah: https://vercel.com/martinc2003s-projects/web-journal/8V8G4djpULXNbd82VrYWMWA8MaBH
this was the thread that helped out the most: https://stackoverflow.com/questions/79290285/issues-deploying-client-and-server-on-the-same-origin-in-vercel-monorepo-setup or what I was tryna do anyways
Spectacled bear
Oh okay, you've set up monorepo. BTW I cannot view your deployment on Vercel.