bullmq: Intermittent "Lua redis() command arguments must be strings or integers"

This intermittent error is happening when moveToFinished Lua script is being called.

When capturing the failed event [i.e. worker.on(‘failed’, (job, error) => {…})] the following data is produced:

job:

{
    "id": "8",
    "name": "eml",
    "data": "{\"templateId\":\"server_shutdown\",\"subject\":\"[Meeting-Test] Server Report - Shutdown\",\"data\":{\"serverInfo\":{\"env\":\"MOCK_ENV\",\"version\":\"MOCK_VERSION\",\"hostName\":\"MOCK_HOST_NAME\"}},\"options\":{\"isDiagnosticEmail\":true,\"sendAsText\":true,\"skipToAccountBounceVerification\":true},\"toAccounts\":[{\"email\":\"foo@bar.com\"}]}",
    "opts": "{\"attempts\":0,\"delay\":0,\"removeOnComplete\":100}",
    "progress": 0,
    "attemptsMade": 1,
    "processedOn": 1574214599662,
    "timestamp": 1574214599674,
    "failedReason": "\"ERR Error running script (call to f_ae2c40fe4d28cbdf1e2fe57d1682bc203603a506): @user_script:107: @user_script: 107: Lua redis() command arguments must be strings or integers \"",
    "stacktrace": "[\"ReplyError: ERR Error running script (call to f_ae2c40fe4d28cbdf1e2fe57d1682bc203603a506): @user_script:107: @user_script: 107: Lua redis() command arguments must be strings or integers \\n    at parseError (~/server/node_modules/ioredis/node_modules/redis-parser/lib/parser.js:179:12)\\n    at parseType (~/server/node_modules/ioredis/node_modules/redis-parser/lib/parser.js:302:14)\"]",
    "returnvalue": "0"
}

error:

{
    "command": {
        "name": "evalsha",
        "args": [
            "ae2c40fe4d28cbdf1e2fe57d1682bc203603a506",
            "7",
            "m2:emlq:active",
            "m2:emlq:completed",
            "m2:emlq:8",
            "m2:emlq:wait",
            "m2:emlq:priority",
            "m2:emlq:events",
            "m2:emlq:meta",
            "8",
            "1574214599677",
            "returnvalue",
            "null",
            "completed",
            "101",
            "{\"jobId\":\"8\"}",
            "0",
            "m2:emlq:",
            "0572fc7e-3069-4155-97b7-aafd738128ac",
            "30000"
        ]
    }
}

Notice that all of the args are strings.

Even when I insert my own logging code in scripts.ts, the args are as follows:

moveToFinished ARGS: [
  'm2:emlq:active',
  'm2:emlq:completed',
  'm2:emlq:8',
  'm2:emlq:wait',
  'm2:emlq:priority',
  'm2:emlq:events',
  'm2:emlq:meta',
  '8',
  1574214599677,
  'returnvalue',
  'null',
  'completed',
  '101',
  '{"jobId":"8"}',
  0,
  'm2:emlq:',
  '0572fc7e-3069-4155-97b7-aafd738128ac',
  30000
]

You can see that they are all integers and strings.

The unit test I am performing does 100 identical jobs in a row but only some produce this error. Any thoughts on how I should track this down?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (10 by maintainers)

Commits related to this issue

Most upvoted comments

For anyone who ends up here in the future, we encountered this error when we tried to add a job to the queue which accidentally had an undefined value for its name.

For anyone who ends up here in the future, we encountered this error when some modules had been upgraded to bullmq but others had not. Upgrading all modules to bullmq seemed to fix the issue.

@yogendrajs you are on a very old version of BullMQ, why not upgrade to latest?

still facing this error with the following dependencies version and the Redis server version Redis 7.0.10 (00000000/0) 64 bit-

"dependencies": {
    "bullmq": "1.87.1",
    "ioredis": "4.28.5"
  }