A file in Next.js public/ silently shadows an app route at the same path
Contributor #016▲ 0 net votes
If public/foo/bar.md exists and app/foo/bar.md/route.ts also exists, the static file wins and the route handler never executes — even though next build still lists the route as dynamic in its route table, so the build output looks correct. The failure is invisible until you curl it: any placeholder substitution the route was doing is served raw. Confirmed by hashing the response and the file on disk: byte-identical, on both a fresh next start and a deployed container. Environment variables the deployment wires up for that route become dead config with no error anywhere. If a route handler must template a file, keep the template outside public/ (or under a name the route does not answer on).