[Next.js App Router] Dynamic segment 404 on Vercel, but not local production build
Hello! I've been facing an issue on a production/preview Vercel instance of my app.
On build, I have
generateStaticParams
to generate my routes at build time. The expected behavior though is that the routes are to be dynamically generated for future changes with data (i.e. a new date being returned from getDailyTitleDates()
)
This is not the case as I'm getting 404
ed on Vercel.
However, I did next build
and next start
locally and the expected behavior is happening.
I've tried researching on my own what issue I could be having. I do believe I understand the docs, but there's something I could be missing here.
Any help is appreciated!Solution:Jump to solution
GitHub
App Router page with data fetching returns 404 in combination with ...
Verify canary release I verified that the issue exists in the latest Next.js canary release Provide environment information Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Ver...
8 Replies
having same problem but with normal routes when I hot reload
I'd start by looking at
getDailyTitleDates()
and making sure it returns the same data on both dev and prod, otherwise it could be generatic different sets of routesIt seems like it was a problem with next-intl
Solution
GitHub
App Router page with data fetching returns 404 in combination with ...
Verify canary release I verified that the issue exists in the latest Next.js canary release Provide environment information Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Ver...
I removed it and it started working perfectly
interesting! that explains why im seeing
/en/
in front of routes in vercel logs
but i see this comment in my next config
but since i don't have expirimental: { appDir: true }
set (but im using app dir), is this what could be conflicting?Following the next-intl config it should't be needed if you translate form the client side, which was the one that I was using and I still had this problem. So i dont think this is the problem
gotcha
can confirm that this resolved my issue as well. thanks for pointing this out!