Skip to content

json.get sometimes returning a string instead of json #2937

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
CaptainCodeman opened this issue May 2, 2025 · 2 comments · Fixed by #2944
Closed

json.get sometimes returning a string instead of json #2937

CaptainCodeman opened this issue May 2, 2025 · 2 comments · Fixed by #2944
Assignees
Labels

Comments

@CaptainCodeman
Copy link

Description

I have two separate projects that have the same issue after upgrading from 4.7.0 to 5.0.0, and downgrading back to 4.7.0 fixes the issue on both.

json.get occasionally returns the result as a single string instead of json, like JSON.parse isn't being used.

Given this code:

await redis.json.set('test', '$', { name: 'CaptainCodeman' })
const data = await redis.json.get('test')
console.log(typeof data, data)

Version 4.7.0 outputs object { name: 'CaptainCodeman' }
Version 5.0.0 outputs string {"name":"CaptainCodeman"}

Strangely, it doesn't seem to be consistent - some data / keys work as expected and others don't, some work and then stop working at a certain point in the code, it's very odd.

The data in redis itself is always identical and is JSON:

Image

Node.js Version

v22.11.0

Redis Server Version

7.4.2

Node Redis Version

5.0.0

Platform

macOS

Logs

@nkaradzhov nkaradzhov self-assigned this May 5, 2025
nkaradzhov added a commit to nkaradzhov/node-redis that referenced this issue May 5, 2025
there was some sort of a circular dependency
in <module>/lib/commands/index.ts for various modules

fixes redis#2937 fixes redis#2941
@kevin-brashears-fhr
Copy link

@nkaradzhov is there a 5.0.2 release to fix this and #2941?

@nkaradzhov
Copy link
Collaborator

@kevin-brashears-fhr we are gonna release this week i think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants