Error 404 when deploying a monorepo in vercel
Answered
muted posted this in #help-forum
mutedOP
I have this 404 error problem, the build has no errors, so much so that the deployment works, but when I visit the page this error appears. Can someone help me? If anyone has experienced this and has a solution, I will provide more information if necessary
Answered by Z4NR34L
just remove vercel.json from your repository root - you told vercel to build NODE application there 😄
102 Replies
@Z4NR34L Probably you not configured project's root directory
mutedOP
Someone warned me about this and I set it up, my next one is in the web folder. And even when configuring the directory this error is occurring
mutedOP
Another thing I noticed is that the deploy summary has that message there: "No framework detected"
yeah, that will be next thing that we will get into 😉
first change deploy commant and redeploy this deployment
@Z4NR34L Click to see attachment
mutedOP
ok, I'll try
I changed and reimplemented
The 404 error persisted
ok, could you share build logs?
brilliant 😄
ok, i didn't catched anything that's wrong here
@Z4NR34L ok, i didn't catched anything that's wrong here
mutedOP
Yes, strange that the project is working normally in the development environment
Let's try creating this project on vercel from scratch together - Vercel should be able to find framework by itself
right in 1st step
there should be a list of packages that are available
Just tell me what I need to do and I'll follow
select your monorepo repository
the root directory should be automatically found
and when you click edit, you should see an monorepo apps list with framework icon if detected
mutedOP
perfect
mutedOP
now change build command
turbo run build --filter=web@muted Click to see attachment
you can verify if framework is detected when you unfold apps folder 😄
there should be a framework icon next to app's name
haha, yeah, I often forget about it on first try 😄
@Z4NR34L haha, yeah, I often forget about it on first try 😄
mutedOP
Do you add a variable that has named
NEXT_ PUBLIC _?you should add now anything that's needed for project to build
any credentials, api urls etc. any envs that you are using
@Z4NR34L you should add now anything that's needed for project to build
mutedOP
At the moment I'm using just 1 variable, and I added
NEX_PUBLIC to the name to make it work, should I add that name there too?Just look
that's not safe solution, you should not be making credentials public 😄
adding
NEXT_PUBLIC_ prefix to env is allowing to access it from client-side, envs without it are not accessible for users - they are only server-side@Z4NR34L that's not safe solution, you should not be making credentials public 😄
mutedOP
I added just the name per account I saw in a Next document, but my .env is not sent to the repo
you don't need and really shouldn't be pushing .env files to repository haha
you are using those envs in any pages that use SSG feature?
or only in api calls
@Z4NR34L or only in api calls
mutedOP
only in calls
ok, so you should be able to deploy this app without them for now, and add them later when we get working deployment 😄
or you got deployment rejected?
I finished, unfortunately there was an error :/
ok, is you repository public?
could I get an url? 😄
thx!
this warning shows up because the 404 was triggered on vercel infrastructure, not your application
just give me a few seconds 😄
@Z4NR34L just give me a few seconds 😄
mutedOP
Oh, ok thanks
just remove vercel.json from your repository root - you told vercel to build NODE application there 😄
Answer
when there is no node application in that place
after that you can just deploy this project from scratch without touching any setting and it will go as should
{
"version": 2,
"builds": [
{
"src": "apps/web",
"use": "@vercel/node"
}
]
}there is your vercel.json, you set @vercel/node runtime 😄
yeah
just remove whole file
you don't need it from what I had seen 😄
@Z4NR34L just remove whole file
mutedOP
Okay, I will remove
Thank you veryyy much
I will redeploy and send you the result
no problem 😉
If you will need any further assistance, feel free to get in touch on Discord!
also please mark solution message to mark whole topic as solved 🙂
mutedOP
Thanks, I'm very grateful
@Z4NR34L also please mark solution message to mark whole topic as solved 🙂
mutedOP
How do I mark the message?
right click on mesage > apps > mark solution
mutedOP
I got it, thanks

