Skip to content

fix: skip the messages route cache when caching is disabled - #4113

Open
lazerg wants to merge 1 commit into
nuxt-modules:mainfrom
lazerg:fix/messages-cache-disabled-redis
Open

fix: skip the messages route cache when caching is disabled#4113
lazerg wants to merge 1 commit into
nuxt-modules:mainfrom
lazerg:fix/messages-cache-disabled-redis

Conversation

@lazerg

@lazerg lazerg commented Jul 30, 2026

Copy link
Copy Markdown

When message caching is disabled, the production route still runs through Nitro's cached event handler, and the module passes maxAge: -1 there to mean "do not cache". Nitro treats that as a real expiry and writes the response to storage with a negative TTL, which a Redis driver rejects with ERR invalid expire time in set. The route already serves uncached in development, so this now does the same whenever caching is off, keeping the negative TTL from ever reaching the store.

Summary by CodeRabbit

  • Bug Fixes

    • Message responses now correctly bypass caching when caching is disabled, preventing unintended cache writes.
  • Tests

    • Added coverage to verify that disabled caching returns messages without attempting to write cache entries.

@lazerg
lazerg requested a review from BobbieGoede as a code owner July 30, 2026 12:09
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: aff8745b-5509-428d-97dc-615a6dfc3f58

📥 Commits

Reviewing files that changed from the base of the PR and between a0b2db7 and 25d6302.

📒 Files selected for processing (2)
  • src/runtime/server/routes/messages.ts
  • test/messages-route.test.ts

Walkthrough

The messages route now uses the non-cached handler when development mode is enabled or __I18N_CACHE__ is disabled. A Vitest suite mocks the cache and i18n utilities, loads the route with a mock event, and verifies that disabled caching returns localized messages without performing cache writes.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: bypassing the messages route cache when caching is disabled.
Linked Issues check ✅ Passed The changes address #4112 by routing around the cached handler when I18N_CACHE is disabled and adding a regression test.
Out of Scope Changes check ✅ Passed The diff is focused on the cache-bypass fix and its test, with no obvious unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Messages cached handler with redis => ReplyError: ERR invalid expire time in set

1 participant