Bull: Unhandled rejection ReplyError: ERR unknown command 'client'

Created on 20 Jul 2018  路  10Comments  路  Source: OptimalBits/bull

Description

Hosting a redis instance on Gcloud and when the worker starts I get this error:

Unhandled rejection ReplyError: ERR unknown command 'client'
    at JavascriptRedisParser.returnError (/app/node_modules/ioredis/lib/redis/parser.js:24:25)
    at JavascriptRedisParser.execute (/app/node_modules/redis-parser/lib/parser.js:572:12)
    at Socket.<anonymous> (/app/node_modules/ioredis/lib/redis/event_handler.js:107:22)
    at Socket.emit (events.js:182:13)
    at Socket.EventEmitter.emit (domain.js:442:20)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at TCP.onread (net.js:638:20)

I do see that the CLIENT command is unsupported on gcloud redis https://cloud.google.com/memorystore/docs/reference/redis-configs#blocked

Bull version

3.4.3

PR REQUEST enhancement

Most helpful comment

@shamiln this works for me

const Redis = require("ioredis")
Redis.Promise = require("bluebird")

// noop, client is not available on gcp redis
Redis.prototype.client = function() {}

const Queue = require("bull")

new Queue("queue", {
  createClient() {
    return new Redis()
  },
})

All 10 comments

Ok. We will need to have some kind of failback when this method fails, since it is not critical, just used to name the different workers.

As a workaround, you could monkey patch ioredis so that the client method becomes a noop, since I have yet not a nice solution for this.

I switched to Redis Labs as a quick fix!

So I assume this is the issue? https://github.com/OptimalBits/bull/blob/5144962c13670b36918268151fb459397c15763d/lib/worker.js#L14A

I just ran into this as well. I'll monkey patch for now but another solution would be nice :)

Hey guys, I just got this error as well. Have you figured out some different solution?

@emhagman how did you monkey patch this?

@shamiln this works for me

const Redis = require("ioredis")
Redis.Promise = require("bluebird")

// noop, client is not available on gcp redis
Redis.prototype.client = function() {}

const Queue = require("bull")

new Queue("queue", {
  createClient() {
    return new Redis()
  },
})

Not sure if it's related but I'm using Bull in MemoryStore calling from AppEngine service. Works fine until there is any sort of exception in the job, then the processor crashes and stops responding to incoming jobs (even if the exception is handled).

@shamiln this works for me

const Redis = require("ioredis")
Redis.Promise = require("bluebird")

// noop, client is not available on gcp redis
Redis.prototype.client = function() {}

const Queue = require("bull")

new Queue("queue", {
  createClient() {
    return new Redis()
  },
})

Works for me too.

Note that if you use custom redis parameters e.g. config string:

const REDIS = `redis://:${REDIS_PASS}@${REDIS_HOST}`;

you should pass it to Redis constructor:

  createClient: () => {
    return new Redis(REDIS);
  }

UPD: this fix is unreliable, see #1210 instead

Any updates on this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davedbase picture davedbase  路  3Comments

tdzienniak picture tdzienniak  路  4Comments

thelinuxlich picture thelinuxlich  路  3Comments

rodrigoords picture rodrigoords  路  4Comments

JSRossiter picture JSRossiter  路  3Comments