loopbackio / loopback-connector-redis

EXPERIMENTAL: Redis connector for LoopBack.
http://loopback.io/doc/en/lb2/Redis-connector.html
Other
36 stars 46 forks source link

The function destroyAll fails with error #44

Closed penguinpowernz closed 6 years ago

penguinpowernz commented 7 years ago

When running destroyAll this error is returned:

     TypeError: Cannot read property 'length' of undefined
      at BridgeToRedis.all (lib/redis.js:513:18)
      at BridgeToRedis.destroyAll (lib/redis.js:631:10)
sambonbonne commented 7 years ago

Hi,

I have a similar problem:

/var/app/current/node_modules/loopback-connector-redis/node_modules/redis/index.js:602
                throw err;
                ^

TypeError: Cannot read property 'id' of null
    at /var/app/current/node_modules/loopback-connector-redis/lib/redis.js:635:61
    at /var/app/current/node_modules/loopback-connector-redis/node_modules/async/lib/async.js:567:21
    at /var/app/current/node_modules/loopback-connector-redis/node_modules/async/lib/async.js:246:17
    at /var/app/current/node_modules/loopback-connector-redis/node_modules/async/lib/async.js:122:13
    …

So same function (BridgeToRedis.prototype.destroyAll), not really the same error.

It makes the server crashing, so if you have any idea on how to catch this error and at least prevent the crash, it would be great!

penguinpowernz commented 7 years ago

Hey @smumu if you set your dep in your package.json to penguinpowernz/loopback-connector-redis#44-fix-destroy-all does your problem go away?

vjtc0n commented 7 years ago

Hello @penguinpowernz ,

I tried to use your fix-destroy-all, but it seemed not working for me.

For examples, I have a PersistedModel: Comment which has a field: "content": type "string". Firstly, I used where: { content: content }, it returned error:

Error: Comment: no indexes found for content impossible to sort and filter using redis connector

After that, I added "index": true to "content", but it didn't destroy anything. Did I do something wrong ?

Thank you.

koneapi commented 6 years ago

I think it would be good to get fixes like this one that are in the master branch into an official NPM release. The last NPM release (0.1.0) doesn't contain them. Is there a way I can help make that to happen :-)?

https://groups.google.com/forum/#!topic/loopbackjs/ODqlYaipnjI