Next.js Discord

Discord Forum

Page routes give 404 on production but work fine in local

Answered
Floh posted this in #help-forum
Open in Discord
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 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
Answered by Ray
maybe the broken route is still Page.tsx
View full answer

33 Replies

Here's the deployment if it helps https://portfolio-virid-six-26.vercel.app/
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 "/") and the code is 304
This is what it usually looks like
this is what it looks like on this project
Plott Hound
@Plott Hound are you doing this? https://nextjs-faq.com/fetch-api-in-rsc
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
Okay I just noticed that two of my pages actually do work, but only my subpages

So
- / works
  - /design broken
  - /photography broken
  - /photography/sports works
  - /photograhy/auto works
Plott 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?
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?
I tried deploying as a new project, same issue existed
thought github or cli?
Through vercel UI
import from github?
yeah
could you try deploying new project with vercel cli?
Sure
and check the name of the file on github repo is correct or not
Answer
Sure will do
Omg that’s it
I guess case changes don’t push lmao
yea so I only use kebab case for filename now
deploy with vercel cli work?
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