Dev mode shows static route but when running build it shows dynamic

Hello,

I am running into a strange issue where I have static routes inside a dynamic route but during the build process they show as dynamic routes and are loading on Vercel as dynamic routes as well. Previously with Next.JS 14, I wasn’t having any issues and curious if something changed or if anyone can help. Using Next.js 15.2.4

This is a multi-tenant app with the following structure:

/app/[domain] - Uses generateStaticParams and is correctly building at build time
/app/[domain]/contact - Shows as dynamic during build but static in development mode
/app/[domain]/[slug] - Uses empty array in generateStaticParams and correctly builds on demand

Previously when I would run next build command, it would build the [domain] along with all the nested static routes at build time for pages such as [domain]/contact.

I have verified that all my data fetches have cache set and revalidation so there is no data fetching that doesn’t cache. I am stumped because it was working properly but don’t know the change or exactly when it started not working properly.

Screenshots of the build process, dev mode indicator and cached fetches attached.



Screenshot 2025-03-27 at 12.40.21 PM

I ended up moving the generateStaticParams to the layout file instead of the page and now the static routes are properly built during build time.

Glad you got this working! Thank you for sharing what worked for you :smiley:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.