next-shared-cache icon indicating copy to clipboard operation
next-shared-cache copied to clipboard

`redis-stack` method `revalidateTag` fails with redis error: `Could not parse field spec`

Open eliassjogreen opened this issue 1 year ago • 0 comments

Brief Description of the Bug redis-stack logs Error: Could not parse field spec on other pods when running revalidateTags.

Severity Critical? Makes the redis-stack handler unusable

Frequency of Occurrence Always

Steps to Reproduce Provide detailed steps to reproduce the behavior, including any specific conditions or configurations where the bug occurs:

  1. Use the default cache-handler.js from the k8s example
  2. Start a k8s cluster with an external instance of Redis 7.4 and RedisJSON + RedisSearch
  3. Call revalidateTag from a single of the nextjs pods
  4. Observe how the other pods log Error: Could not parse field spec and fail to revalidate the tag

Expected vs. Actual Behavior I expect all of the pods to revalidate the tags and not log the Redis error: Error: Could not parse field spec. Seems to originate from RedisSearch IndexSpec_AddFieldsInternal method, but could not really track down what the issue actually is or why it happens.

Screenshots/Logs From pod which triggers revalidation:

[CacheHandler] Instance created with provided context.
[12:00:00] INFO: Got request to revalidate page slug index
[CacheHandler] Using existing CacheHandler configuration.
[CacheHandler] [method: revalidateTag] [tags: []] Started revalidating tag in parallel.
[12:00:00] INFO: Revalidated page slug index

From other pods:

[CacheHandler] Instance created with provided context.
[CacheHandler] Using existing CacheHandler configuration.
[CacheHandler] [method: revalidateTag] [tags: [collection:pages_index]] Started revalidating tag in parallel.
[CacheHandler] [handler: local-lru] [method: revalidateTag] [tag: collection:pages_index] Successfully revalidated tag.
[CacheHandler] [handler: redis-stack] [method: revalidateTag] [tag: collection:pages_index] Error: Error: Could not parse field spec
using custom cache handler @neshca/cache-handler with 2 Handlers

Environment:

  • OS: Linux
  • Node.js version: 22
  • @neshca/cache-handler version: Next15 branch (#846) and 1.8.1
  • next version: 15

Dependencies and Versions Redis:

# Server
redis_version:7.4.1
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:7fd3520e9c14a41b
redis_mode:standalone
os:Linux 5.15.0-125-generic x86_64
arch_bits:64

...

# Modules
module:name=ft,ver=10200,api=1,filters=0,usedby=[],using=[],options=[]
module:name=ReJSON,ver=999999,api=1,filters=0,usedby=[],using=[],options=[handle-io-errors]

Attempted Solutions or Workarounds Using the redis-strings handler.

Impact of the Bug Keeps us from using the redis-stack cache handler for our production websites.

Additional context n/a couldn't think of any

eliassjogreen avatar Nov 19 '24 10:11 eliassjogreen