Page routes give 404 on production but work fine in local
Answered
Floh posted this in #help-forum
FlohOP
I have a series of routes aside from my main page that work fine while in my development environment, but in the production deployment they throw 404.
I made a mistake with routing to
Any advice appreciated : D
I made a mistake with routing to
Page.tsx instead of page.tsx on these pages originally, so I wonder if maybe it has to do with caching, but I already tried redeploying without cache.Any advice appreciated : D
33 Replies
FlohOP
Here's the deployment if it helps https://portfolio-virid-six-26.vercel.app/
FlohOP
I found more info
In my vercel logs, each time I try to visit the page, the log shows an attempt to fetch the root (just
In my vercel logs, each time I try to visit the page, the log shows an attempt to fetch the root (just
"/") and the code is 304This is what it usually looks like
this is what it looks like on this project
Plott Hound
are you doing this? https://nextjs-faq.com/fetch-api-in-rsc
@Plott Hound are you doing this? https://nextjs-faq.com/fetch-api-in-rsc
FlohOP
Not that I know of, I'm not fetching any data and it builds without any errors or warnings
This is one of the pages that gives 404
import React from "react";
const Projects = () => {
return <div>Projects</div>;
};
export default Projects;Another interesting thing is the page fully reloads whenever I click one of the links
FlohOP
Okay I just noticed that two of my pages actually do work, but only my subpages
So
So
- / works
- /design broken
- /photography broken
- /photography/sports works
- /photograhy/auto worksPlott Hound
and these routes all work fine in local dev?
side note: you dont need to import react in next
@Plott Hound and these routes all work fine in local dev?
FlohOP
Yes they all work in local
@Floh Yes they all work in local
could you delete the project on vercel and deploy again?
@Ray could you delete the project on vercel and deploy again?
FlohOP
I tried deploying as a new project, same issue existed
thought github or cli?
FlohOP
Through vercel UI
import from github?
FlohOP
yeah
could you try deploying new project with vercel cli?
FlohOP
Sure
and check the name of the file on github repo is correct or not
Answer
yea so I only use kebab case for filename now
deploy with vercel cli work?
FlohOP
Actually no because I’m working on gitpod and it cloned the version with the caps haha
I think that should fix it though once I change it, I’ll come back if not
oh ok
please mark solution when your issue has been solved