You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the SSR cache example, exactly in this line the data seems to be undefined when debugging. Because of this the SSR response couldn't be cached.
const ssrCache = cacheableResponse({
ttl: 1000 * 60 * 60, // 1hour
get: async ({ req, res }) => {
// --> The value of data is always null
const data = await app.render(req, res, req.path, {
...req.query,
...req.params,
})
// Add here custom logic for when you do not want to cache the page, for
// example when the page returns a 404 status code:
if (res.statusCode === 404) {
res.end(data)
return
}
return { data }
},
send: ({ data, res }) => res.send(data),
})
The value of data should actually be the response HTML that gets cached.
To Reproduce
1. curl https://codeload.github.com/vercel/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/ssr-caching
2. cd ssr-caching
3. npm install and npm run dev
Expected behavior
The value of data should actually be the response HTML that gets cached in the next step.
Screenshots
System information
OS: Mac OS
Browser: Chrome
Version of Next.js: 9.5.2
Version of Node.js: 12.16.3
Additional context
An unhandledPromiseRejection error is thrown due to the data being undefined.
The text was updated successfully, but these errors were encountered:
prasanna1211
changed the title
app.render returns null in SSR cache example
app.render returns undefined in SSR cache example
Aug 20, 2020
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
vercel
locked as resolved and limited conversation to collaborators
Jan 28, 2022
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Bug report
Describe the bug
In the SSR cache example, exactly in this line the data seems to be
undefined
when debugging. Because of this the SSR response couldn't be cached.The value of data should actually be the response HTML that gets cached.
To Reproduce
Expected behavior
The value of data should actually be the response HTML that gets cached in the next step.
Screenshots
System information
Additional context
An unhandledPromiseRejection error is thrown due to the data being undefined.
The text was updated successfully, but these errors were encountered: