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

Promisify broken! #916

Closed
jhohlfeld opened this issue Nov 2, 2015 · 2 comments
Closed

Promisify broken! #916

jhohlfeld opened this issue Nov 2, 2015 · 2 comments
Labels

Comments

@jhohlfeld
Copy link

Hello everyone,

I am using node_redis 2.2.5

I think the promisification might break in this version. Follwing the README.md brought no success:

var redis = require('redis');
bluebird.promisifyAll(redis.RedisClient.prototype);

I also tried using the approach as seen in #606 (comment):

var Promise = require("bluebird");
Promise.promisifyAll(require("redis"));
var db = redis.createClient...
db.getAsync(key).then()
...

And finally:

var redis = bluebird.promisifyAll(require('redis'));

However, I could not use the .then() interface at all:

// var redis = require('redis');
// bluebird.promisifyAll(redis.RedisClient.prototype);
var redis = bluebird.promisifyAll(require('redis'));
var client = redis.createClient(_options.redisUrl);
client.hgetall(_hash).then( /*...*/ );

The VM simply keeps saying TypeError: client.hgetall(...).then is not a function. Is there a problem with the current implementation of node_redis or am i just too stupid to do it right?

cheers

Jakob

@jhohlfeld
Copy link
Author

I have to add, the current tag v.2.3.0 seems to have this error as well.

@BridgeAR
Copy link
Contributor

BridgeAR commented Nov 2, 2015

@jhohlfeld please use client.hgetallAsync(_hash).then(res => {}); as described in the readme

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

No branches or pull requests

2 participants