Pro Tip: Do not use headers or cookies in unstable_cache
Answered
meenie posted this in #help-forum
meenieOP
If you do, the cache will be inconsistent and wreak havoc on your application. It will not manifest itself locally as I'm assuming
unstable_cache acts differently in local development. There is no mention of this in the documentation and I only figured it out because I upgraded to the canary release. The moment I booted up the app it helpfully threw an error saying that you shouldn't. Once I removed those from the function inside of unstable_cache, my app started to work perfectly. This has been plaguing me for months and has stopped me from sending it to production.Answered by meenie
I created a PR to update the docs: https://github.com/vercel/next.js/pull/62202
2 Replies
meenieOP
I created a PR to update the docs: https://github.com/vercel/next.js/pull/62202
Answer
meenieOP
PR landed. Marking this as solved.