The SSR caching login is broken with the error below.
(node:14465) UnhandledPromiseRejectionWarning: TypeError: argument entity is required
at etag (/home/omar/Desktop/ssr-caching-app/node_modules/etag/index.js:72:11)
at /home/omar/Desktop/ssr-caching-app/node_modules/cacheable-response/index.js:95:32
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:14465) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:14465) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Steps to reproduce the behavior, please provide code snippets or a repository:
It should cache pages normally.
It was working fine on our project, until it didn't when I upgraded to v9.5.2 from v9.5.1
So I thought of testing the official example, just to find out the same issue!
9.5.1 is not working for me 馃槀
a new user of next wants to configure ssr-caching and is very frustrated
Any update on this?
It is related to:
Not sure what is the plan here, is it safe to still use renderToHTML or is it gonna be made private soon
This is so sudden, they've already broke our production application. There should be a quick alternative.
https://github.com/vercel/next.js/issues/14737#issuecomment-680092517
Refer to @Charioteer鈥榮 ideas
Modify the get method of ssr-caching demo
get: async ({ req, res }) => {
const rawResEnd = res.end
const data = await new Promise((resolve) => {
res.end = (payload) => {
if (res.statusCode === 200) {
resolve(payload)
} else {
resolve()
}
}
app.render(req, res, req.path, {
...req.query,
...req.params,
})
})
res.end = rawResEnd
return { data }
},
Currently we can write like this first 馃槉
Since the response needs to be terminated correctly when the send is executed, the res.end modified in get needs to be restored
I have the same error in Next.js rendering with serverless target. I can't see how exactly is this connected to our app code from this stack trace. Is this a problem with the vendor etag package?
Versions are:
Next.js 9.5.3
[email protected]
TypeError: argument entity is required,
at etag (/var/task/node_modules/next/dist/compiled/etag/index.js:1:738),
at sendPayload (/var/task/node_modules/next/dist/next-server/server/send-payload.js:1:473),
at renderReqToHTML (/var/task/pages/_error.js:732:13),
at processTicksAndRejections (internal/process/task_queues.js:97:5),
at async Module.render (/var/task/pages/_error.js:801:22),
at async handleOriginRequest (/var/task/index.js:5531:9),
at async Runtime.handler$1 [as handler] (/var/task/index.js:5398:20)
I have the same problem.
@ppbl Even with that workaround, the issue still occurs.
Perhaps it's time for Nextjs team to take action.
We rely on renderToHtml in order to modify the raw html server side before sending it to the client, it seems like that鈥檚 on shaky ground. Can we get an alternate solution for rendering out raw HTML using nextjs?
Most helpful comment
https://github.com/vercel/next.js/issues/14737#issuecomment-680092517
Refer to @Charioteer鈥榮 ideas
Modify the get method of ssr-caching demo
Currently we can write like this first 馃槉
Since the response needs to be terminated correctly when the
sendis executed, theres.endmodified ingetneeds to be restored