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
TypeError: res.hasHeader is not a function
at Object.setRevalidateHeaders (/Users/martonpa/Sources/my-app/node_modules/next/dist/server/send-payload/revalidate-headers.js:8:37)
at Object.sendRenderResult (/Users/martonpa/Sources/my-app/node_modules/next/dist/server/send-payload/index.js:62:33)
at NextNodeServer.sendRenderResult (/Users/martonpa/Sources/my-app/node_modules/next/dist/server/next-server.js:394:34)
at NextNodeServer.pipe (/Users/martonpa/Sources/my-app/node_modules/next/dist/server/base-server.js:419:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.fn (/Users/martonpa/Sources/my-app/node_modules/next/dist/server/next-server.js:759:21)
at async Router.execute (/Users/martonpa/Sources/my-app/node_modules/next/dist/server/router.js:253:36)
at async NextNodeServer.run (/Users/martonpa/Sources/my-app/node_modules/next/dist/server/base-server.js:384:29)
at async NextNodeServer.handleRequest (/Users/martonpa/Sources/my-app/node_modules/next/dist/server/base-server.js:322:20)
Describe the Bug
Using cookies within a server component breaks the on-demand revalidation.
Expected Behavior
On-demand revalidation should work for pages using next/headers functions.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered:
Hi, using cookies() causes a page to be dynamic and not statically generated so On-Demand ISR isn't necessary. The above error shouldn't be thrown though so that will be addressed in #45681
Replaces usage of `hasHeader` of `getHeader` and also ensures we include
`hasHeader` in our `mockRes` we create during revalidate for good
measure.
## Bug
- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)
Closes: #34929Closes: #37338Closes: #45481
jankaifer
pushed a commit
to jankaifer/next.js
that referenced
this issue
Feb 14, 2023
Replaces usage of `hasHeader` of `getHeader` and also ensures we include
`hasHeader` in our `mockRes` we create during revalidate for good
measure.
## Bug
- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)
Closes: vercel#34929Closes: vercel#37338Closes: vercel#45481
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true)
Link to the code that reproduces this issue
https://github.com/patshologram/revalidation-error
To Reproduce
yarn build && yarn start -- -p 3001
Describe the Bug
Using cookies within a server component breaks the on-demand revalidation.
Expected Behavior
On-demand revalidation should work for pages using
next/headers
functions.Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: