How do I implement Caching at SSR for Next.js They have mentioned SSR Caching https://nextjs.org/docs/advanced-features/custom-server which is not working Apparently Next.js have made app.renderToHTML() as obsolete and cant be used with getServerSideProps function and using app.render() in the caching function which always gives undefined and breaks with the following error
(node:20872) UnhandledPromiseRejectionWarning: TypeError: argument entity is required
at etag (C:\xampp\htdocs\next-app\node_modules\etag\index.js:72:11)
at C:\xampp\htdocs\next-app\node_modules\cacheable-response\index.js:93:32
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use node --trace-warnings ... to show where the warning was created)
(node:20872) 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:20872) [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.
because of which the above example breaking.
Here is the github link where I have raised an issue https://github.com/vercel/next.js/issues/25579
Can any one help me in this?
renderToHTMLin that example, as you mentioned in your question.