next.js: Error: invariant: dynamic responses cannot be unchunked
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
A next 13 production build hosted on GCP Kubernetes
Which area(s) of Next.js are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue
it’s a private repository and I cannot share the code. I think it should be easily reproducible
To Reproduce
Just run the latest Nextjs 13 on production
Describe the Bug
Hello,
I have recently installed the latest next 13 (“next”: “13.1.4”), and ran it on production (despite being experimental yet) and started receiving occasional error logs on the server side. However, the web app itself loads properly and everything works normally so far (2 days up time on production).
Here is the error:
Error: invariant: dynamic responses cannot be unchunked. This is a bug in Next.js at RenderResult.toUnchunkedString (/usr/src/app/node_modules/next/dist/server/render-result.js:16:19) at /usr/src/app/node_modules/next/dist/server/response-cache/index.js:103:57 at processTicksAndRejections (node:internal/process/task_queues:96:5)
Expected Behavior
Not to have this bug log in Next 13 I suppose
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 10
- Comments: 18 (3 by maintainers)
I was using a custom server implementation, where I use app.renderToHTML. This causes the issue for me.
Was resolved in https://github.com/vercel/next.js/pull/52581
I’m getting the same error v 13.4.4. Did you solve it? Thanks!
We’re getting the same issue in v 13.4.4 with AppRouter. The website works fine, but the error log is full of these types of errors. The server is a Windows server running PM2.
In
node_modules\next\dist\server\render-result.js
:https://github.com/vercel/next.js/blob/e4b230677c24744ff2a2253a475d271c38d1443f/packages/next/src/server/render-result.ts#L49