Skip to content
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

redis client legacy v4 API uses callbacks instead of promises #2398

Closed
aleissner opened this issue Jan 30, 2023 · 3 comments · Fixed by #2402
Closed

redis client legacy v4 API uses callbacks instead of promises #2398

aleissner opened this issue Jan 30, 2023 · 3 comments · Fixed by #2402
Labels

Comments

@aleissner
Copy link

Description

Using @redis/client with legacy mode, I can no longer access the v4 promise API.
Calling set or get function under v4 gives me callback functions.

` const client = createClient({ legacyMode: true });

client.on('error', err => console.log('Redis Client Error', err));

// @ts-ignore
await client.connect();

await client.v4.set('key', 'value', () => { console.log('callback') });
const value = await client.v4.get('key');
console.log('test value', value);
client.v4.get('key', (err, val) => { console.log('callback get', err, val); }

// @ts-ignore
await client.disconnect();`

Node.js Version

18.11

Redis Server Version

7.0.5

Node Redis Version

@redis/client 1.5.4

Platform

macOS

Logs

No response

@aleissner aleissner added the Bug label Jan 30, 2023
@leibale
Copy link
Collaborator

leibale commented Jan 30, 2023

I'm actually not sure why the tests didn't catch this, checking now... Sorry about that.

@leibale
Copy link
Collaborator

leibale commented Jan 30, 2023

The tests only tested .v4.sendCommand... 🤦‍♂️
Ok, I found the issue, working on a fix (+ I'll add a test to make sure it won't happen again) now

leibale added a commit to leibale/node-redis that referenced this issue Jan 30, 2023
leibale added a commit that referenced this issue Jan 30, 2023
@leibale
Copy link
Collaborator

leibale commented Jan 30, 2023

[email protected]/@redis/[email protected] is on npm 🎉

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.

2 participants