404 on vercel if route to /
Unanswered
Sweat bee posted this in #help-forum
Sweat beeOP
hey, my app runs fine locally but if deployed to vercel I am getting 404 when I click a link routed to '/'. All other routes are working!
My folder structure is highly dynamic, fetching all pages from contentful and prerendering it. I grouped two static routes with the dynamic into a main group, see below...
Any idea why I this is happening?
My folder structure is highly dynamic, fetching all pages from contentful and prerendering it. I grouped two static routes with the dynamic into a main group, see below...
Any idea why I this is happening?
12 Replies
Sweat beeOP
I have an updated image of my folder structure:
And here is a screenshot of my build:
well you dont have a / page
What @Arinji said -> Put a page.tsx under the app folder
Sweat beeOP
and then? The root page ('/') is supposed to be fetched dynamically... is this not possible?
in the pages directory I could have something like this:
its basically the same except of the (main) group which is considered to be not affecting the URL hierarchy
Sweat beeOP
But it could be the root layout missing on app folder... I am gonna try this out!
hmm no that didnt help
its weird if I refresh the page it shows up
Sweat beeOP
I digged a bit deeper into it and logged out my params on the pages... apparently the slug for the root on localhost is empty but on vercel its 'index'. I check the slug if its empty and then use / to ask contentful for data... if I have a slug '/' in contentful I get the page, but if data is empty I return a 404
due to the fact I have no index in contentful I am getting a 404 🙂