Hi All,
I'm self hosting nextjs in a docker container (for now). Everything is working mostly smoothly, but when things go wrong it's almost impossible to figure out why.
I get error messages like this:
Error: Failed to find Server Action "null". This request might be from an older or newer deployment. Original error: Invariant: Missing 'next-action' header.
at rv (/app/apps/frontend/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:1666)
at /app/apps/frontend/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:15:7002
at AsyncLocalStorage.run (node:async_hooks:346:14)
at rg (/app/apps/frontend/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:15:6317)
at rz (/app/apps/frontend/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:24715)
at /app/apps/frontend/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:27397
at AsyncLocalStorage.run (node:async_hooks:346:14)
at Object.wrap (/app/apps/frontend/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:13:16207)
at /app/apps/frontend/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:27287
at AsyncLocalStorage.run (node:async_hooks:346:14)
That's usually because some server action couldn't be called, or was dodgy, or w.e. My gripe isn't with the error, it's with figuring out what caused the error.
Is there anyway to improve the error output experience when selfhosting? Ideally by including source maps or something so that specific files and lines of code are highlighted, rather than obscure positions in budled code.
I'll post the dockerfile in a moment.