fix(content): bundle src/static-content into standalone output

The content endpoints (content.get / checkTosUpdate tRPC procedures and the
/content/[[...slug]] and /safety pages) read markdown from src/static-content/*.md
at runtime via fs (resolve('src/static-content/...')). Next output-file-tracing
cannot follow a dynamically-built fs read, so the .md files were only ever
included in standalone builds incidentally.

A lockfile regen (eaa5e7926, next 14.2.28 -> 14.2.31) changed nft/standalone
tracing and stopped copying src/static-content into .next/standalone. Result:
every content read in prod hit ENOENT and returned 404 (ToS, Privacy, Safety).
Confirmed on live dp-prod images: April tag had /app/src/static-content with the
.md, current tag is missing them; local dev (files on disk) returns 200.

Fix: outputFileTracingIncludes forces nft to copy the dir into .next/standalone
for the routes that read it. Verified by building the in-repo Dockerfile (the same
one Tekton uses) and inspecting the image: /app/src/static-content now ships all
42 .md files.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Justin Maier
2026-06-05 12:16:06 -06:00
parent 2c948ddb9b
commit d48a46b0af
+12
View File
@@ -107,6 +107,18 @@ export default defineNextConfig(
experimental: {
// scrollRestoration: true,
cpus: 8,
// The content endpoints read markdown from src/static-content/*.md at runtime via
// fs (resolve('src/static-content/...')). Output-file-tracing can't see a dynamic fs
// read, so a Next 14.2.31 / nft change (lockfile bump in eaa5e7926) stopped copying
// those .md into .next/standalone -- every read hit ENOENT and returned a 404 in prod
// (ToS, Privacy, Safety, etc). Force-include the dir for every route that reads it so
// the standalone build ships it alongside server.js. (In standalone these merge into
// one shared tree, so any one key is sufficient; all three are listed for clarity.)
outputFileTracingIncludes: {
'/api/trpc/[trpc]': ['./src/static-content/**/*'], // content.get / checkTosUpdate
'/content/[[...slug]]': ['./src/static-content/**/*'], // /content/tos, /content/2257, ...
'/safety': ['./src/static-content/**/*'],
},
serverSourceMaps: true,
instrumentationHook: true, // Enable instrumentation.ts for OTEL
largePageDataBytes: 512 * 100000,