stipsan / ioredis-mock

Emulates ioredis by performing all operations in-memory.
MIT License
333 stars 125 forks source link

Calling an unsupported command in a lua script results in an unclear error #1336

Open hertzquake opened 9 months ago

hertzquake commented 9 months ago

I have a lua script that was calling zmpop (which is, at the time of writing, unsupported).

Calling this script results in this error: Error trying to loading or executing lua code string in VM: null I traced the error down, and found that:

 TypeError: Cannot read properties of undefined (reading 'bind')
    at _RedisMock.<anonymous> (node_modules/ioredis-mock/src/commands/defineCommand.js:58:19)
    at Object.luaD_precall (/node_modules/fengari/src/ldo.js:169:21)
    [very long stack trace omitted...]

The interesting line here is (src/commands/defineCommand.js:52):

const redisCmd = commands[name].bind(this)