Skip to content
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

Queue cannot be created with redis config as string #2118

Closed
ales-albert-kilbergr opened this issue Jul 28, 2021 · 8 comments
Closed

Queue cannot be created with redis config as string #2118

ales-albert-kilbergr opened this issue Jul 28, 2021 · 8 comments
Labels

Comments

@ales-albert-kilbergr
Copy link

Description

Queue object cannot be created with options.redis as string any more. Which has been possible in version 3.23.0

Minimal, Working Test code to reproduce the issue.

The change causing the change of behavior lays here:

v3.23.3...v3.25.0 in Queue.js line 280

Screenshot 2021-07-28 110242

The @types/bull library declares redis property as: Redis.RedisOptions | string | undefined; but the Queue.js:280 by using _.assign(...) breaks the string into an object. The difference between both versions (3.23.0 - 3.25.0) looks then like this:

//@v3.23.0
redis://@foo:6379

//@v3.25.0
{
      '0': 'r',
      '1': 'e',
      '2': 'd',
      '3': 'i',
      '4': 's',
      '5': ':',
      '6': '/',
      '7': '/',
      '8': '@',
      '9': 'f',
      '10': 'o',
      '11': 'o',
      '12': ':',
      '13': '6',
      '14': '3',
      '15': '7',
      '16': '9',
      connectionName: 'bull:dGVzdFF1ZXVl'
    }

Bull version

3.23.0 vs 3.25.0

Additional information

@ales-albert-kilbergr
Copy link
Author

@manast
Copy link
Member

manast commented Jul 28, 2021

This was actually an undocumented feature that should not be possible in the first place, please see this: #2116
But if there are external llibraries depending on bull that use this approach it may be worth fixing it.

@eliotik
Copy link

eliotik commented Jul 28, 2021

Not only external libraries can be a problem but how do you suppose to split url provisioned to environment to host, port, password, username?

@manast
Copy link
Member

manast commented Jul 28, 2021

@eliotik you just pass the "host" option like you do in ioredis: https://github.com/luin/ioredis/blob/master/API.md#new-redisport-host-options

@manast
Copy link
Member

manast commented Jul 28, 2021

@eliotik or well, maybe I do not understand what you mean... you can either pass the url as a string and/or you pass an options object with whatever options you need. What you cannot do is passing a string with options attached to it, which imho seems like an antipattern to me.

@eliotik
Copy link

eliotik commented Jul 29, 2021

@eliotik you just pass the "host" option like you do in ioredis: https://github.com/luin/ioredis/blob/master/API.md#new-redisport-host-options

not exactly. host is url where redis is located, like boomboom.com.
what you actually use is a fully loaded parametrized url:
redis://username:yourfancypassword@host:port/dbid
so you cannot just take this string and define it as a value for host, or you can? :)

@manast
Copy link
Member

manast commented Jul 29, 2021

@eliotik I think you are misunderstanding the issue. You can still do: new Queue(queueName, 'redis://username:yourfancypassword@host:port/dbid', otherRedisOpts);

jonmast pushed a commit to jonmast/arena that referenced this issue Sep 7, 2021
Bull no longer allows passing the URL directly as the value of
`options.redis`. Instead, pass URL as a separate argument when present.

See OptimalBits/bull#2118 for additional
context.
jonmast pushed a commit to jonmast/arena that referenced this issue Sep 8, 2021
Bull no longer allows passing the URL directly as the value of
`options.redis`. Instead, pass URL as a separate argument when present.

See OptimalBits/bull#2118 for additional context.
jonmast added a commit to jonmast/arena that referenced this issue Sep 8, 2021
Bull no longer allows passing the URL directly as the value of
`options.redis`. Instead, pass URL as a separate argument when present.

See OptimalBits/bull#2118 for additional context.
beequeueci pushed a commit to bee-queue/arena that referenced this issue Sep 8, 2021
### [3.29.3](v3.29.2...v3.29.3) (2021-09-08)

### Bug Fixes

* 🐛 Update how Redis URL is passed to Bull ([81bf488](81bf488)), closes [OptimalBits/bull#2118](OptimalBits/bull#2118)
@stale
Copy link

stale bot commented Sep 27, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants