[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())
export async function generateStaticParams() {
const dates: string[] = await getDailyTitleDates();

return dates.map((date: string) => ({
date,
}));
}
export async function generateStaticParams() {
const dates: string[] = await getDailyTitleDates();

return dates.map((date: string) => ({
date,
}));
}
This is not the case as I'm getting 404ed 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:
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...
Jump to solution
8 Replies
JuaniS
JuaniS11mo ago
having same problem but with normal routes when I hot reload
Sturlen
Sturlen11mo ago
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 routes
JuaniS
JuaniS11mo ago
It seems like it was a problem with next-intl
Solution
JuaniS
JuaniS11mo ago
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...
JuaniS
JuaniS11mo ago
I removed it and it started working perfectly
anthony
anthony11mo ago
interesting! that explains why im seeing /en/ in front of routes in vercel logs but i see this comment in my next config
/**
* If you have `experimental: { appDir: true }` set, then you must comment the below `i18n` config
* out.
*
* @see https://github.com/vercel/next.js/issues/41980
*/
/**
* If you have `experimental: { appDir: true }` set, then you must comment the below `i18n` config
* out.
*
* @see https://github.com/vercel/next.js/issues/41980
*/
but since i don't have expirimental: { appDir: true } set (but im using app dir), is this what could be conflicting?
JuaniS
JuaniS11mo ago
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
anthony
anthony11mo ago
gotcha can confirm that this resolved my issue as well. thanks for pointing this out!