''TypeError: Cannot read property 'prototype' of undefined' Redis connections
I am trying to connect to a Redis Azure instance and I'm following the tutorial here Link. However I keep receiving this error
"TypeError: Cannot read property 'prototype' of undefined"
on this line
bluebird.promisifyAll(redis.RedisClient.prototype);
I am using nodeJS on VSCode. I have npm installed redis and bluebird. Any help would be appreciated, thank you!
Solution 1:[1]
"TypeError: Cannot read property 'prototype' of undefined"
1. Make sure to remove import response from { 'express' } which might be got imported by default in your action page.
2. You can refer to how proptotype works under promisifyAll
Class property is a property with a function value that has a non-empty
.prototypeobject. Returns the input object. Note that the original methods on the object are not overwritten but new methods are created with the Async-suffix. For example, if you promisifyAll the node.js fs object use fs.statAsync to call the promisified stat method.
Promise.promisifyAll(require("redis"));
//Later on, all redis client instances have promise returning functions:
redisClient.hexistsAsync("myhash", "field").then(function(v) {
}).catch(function(e) {
});
Reference: TypeError: Cannot read property 'prototype' of undefined React Express and Promise.promisifyAll
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
