New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connection to Redis #53
Comments
Hi, yes,
should be
|
Hey, thanks for your quick answer Stanislav! I already tried with:
Unfortunatly I get I'm not trying to connect to 127.0.0.1 but to a remote url. |
Oops, I did a mistake in my test, I'll update this message with new results. 😕 UPD So yes, this should work
We need to fix docs with correct examples. |
Awesome, it works with |
Hi. With the greatest respect to you for the library, I just wasted a long time on this trying to debug my system as the docs are incorrect. I would really appreciate it if you could update the docs with this correct example. So I think you need to reopen this issue. |
@euanmillar can you please point out where in the documentation the example incorrect is, and I will fix it asap. |
Hi @manast thanks for your reply. The docs say this:
But @stansv says it should be:
So I think that this line:
should be changed to:
But to be honest, I am following @stansv example and doing this:
and I am still getting the: ECONNREFUSED 127.0.0.1:6379 error. My env variable is correctly set to "redis" I still cannot get it to connect. Also I am not getting any TypeScript error. I am using TypeScript |
Here is my code FYI:
|
whats the output of this line in the code above?
|
It outputs this: Initialising queue on REDIS_HOST: redis Looking at the ioredis docs: I think that the connection should be like this:
|
It can also be a string, but maybe you need to format it correctly like |
@manast In the end I need to pass an IP as a string "0.0.0.0" rather than 'redis' and it seems to be connecting without errors now. So, back to the documentation ... I think that the bullmq docs on this page, are incorrect and should be changed: This:
...should be changed to:
... and this:
... should be changed to:
|
I do not think the current documentation is wrong actually... if you pass an instance of IORedis then you need to read in ioredis documentation on how to create an instance that works for your setup. Otherwise you can pass the redis settings directly to the connection and it works. |
Huge thanks @manast ! I think the docs can be improved if you explicitly state "if you pass an instance of IORedis then you need to read in ioredis documentation on how to create an instance that works for your setup." as I am suggesting in the comments in my code example above. I thought 0.0.0.0 seemed to be right for my setup as I am running in a Docker Swarm and while it worked once it has stopped working since. Thanks for the right URL:
Handlers for the connection errors also stop the logs going crazy and you might want to additionally document the connection like this TypeScript example:
|
This solved my problem! November 2020. |
FYI, I fixed this issue by passing a Redis connection to the Worker, which I somehow forgot to do. Everything worked as expected after! |
Is there any reason This seems very odd that you can pass in host / port but not only a string with full connection string... |
I think the docs should mention that |
@lewispham You are right, thanks so much for mentioning this, the docs were not clean about this point. |
Migrating from Bull to BullMQ, and ran into the same issue as people in this thread. We have our Redis connection string in our config settings, and TBH, I'd rather have BullMQ manage its IORedis connection than creating it myself - as a consumer of BullMQ, those are internals that shouldn't be my business. A URL is a very simple approach that works for local development and our setups in the cloud. So maybe it's worth following up on the question from @dan003400 :
Could we place that as a feature request, @manast ? |
@hardcodet sure, if you create a feature request we can add this in a couple of days (I hope). |
bullmq: v1.0.1
I'm not sure how to pass the redis connection. I tried different opts like from the doc (https://docs.bullmq.io/guide/connections) but it either crash with error or connects to 127.0.0.1
am I doing something wrong ?
The text was updated successfully, but these errors were encountered: