Redis cacheHandlers for cacheComponents #86901
Unanswered
Haaxor1689
asked this question in
Help
Replies: 1 comment 15 replies
-
Could this be because the Not really sure what could be happening with issue 1 though. |
Beta Was this translation helpful? Give feedback.
15 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
So I've written a custom cache handler for cacheComponents that connects to a Redis instance. It's using Bun's Redis client and a bit more granular keys than the simple Redis example in NextJs docs. It works well, apart from few edge cases.
When calling "use cache" functions in route handlers, they sometimes just crash (error below). I'm calling the same cached function from both RSC context and route handler context, RSC one always works, route handler crashes when the content it loads is already cached. This crash is also pretty inconsistent, while trying to debug it, it sometimes works based on when I cleared the cache and where it's cached from.Solved[Fast Refresh] rebuildingspam when running in dev mode.I've spent hours trying to debug this issue with absolutely no luck. Tried stable NextJs 16.0.7, 16.1.0 canary releases 2, 10, 12, 15 and also changing Bun's redis to node-redis. None of it helped.
Additional information
Exception thrown when reading cached function from a route handler
Example
https://gist.github.com/Haaxor1689/55e9afd3409030211315fc80db6db462
Beta Was this translation helpful? Give feedback.
All reactions