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

v4.17.0 breaking change for Redis parser #1132

Closed
jamesjjk opened this issue May 16, 2020 · 12 comments · Fixed by #1134
Closed

v4.17.0 breaking change for Redis parser #1132

jamesjjk opened this issue May 16, 2020 · 12 comments · Fixed by #1134
Assignees
Labels

Comments

@jamesjjk
Copy link

Release v4.17.0 fails to parse username:password combinations for redis version 5 and lower. The Rediss / Redis URL connection strings are no longer valid.

[ERROR] The server returned "wrong number of arguments for 'auth' command". You are probably passing both username and password to Redis version 5 or below. You should only pass the 'password' option for Redis version 5 and under.
[ioredis] Unhandled error event: ReplyError: NOAUTH Authentication required.
@luin
Copy link
Collaborator

luin commented May 16, 2020

Thank you for pointing this out. Could you explain the use case why you specifying username:password combinations for Redis <= 5? Or in your case you just want to ignore username?

@Kikobeats
Copy link

Kikobeats commented May 16, 2020

@luin it isn't a thing related with the username: I'm experimenting the same behavior and essentially any URI string like

// Connect to 127.0.0.1:6380, db 4, using password "authpassword":
new Redis("redis://:authpassword@127.0.0.1:6380/4");

doesn't work using at v4.17.0, but works as expected at v4.16.x

@luin luin self-assigned this May 16, 2020
@luin
Copy link
Collaborator

luin commented May 16, 2020

@Kikobeats I can't reproduce this issue locally with the following code:

const redis = new Redis("redis://:authpassword@127.0.0.1:6379/4");

Could you log redis.options and post the result here? username property should be null.

@Kikobeats
Copy link

Kikobeats commented May 16, 2020

❯ cat config/staging.yml | grep REDIS_URI
  REDIS_URI: redis://redis-instance.ec2.cloud.redislabs.com:18529
  
❯ cat node_modules/ioredis/package.json | grep version
  "version": "4.17.0"

❯ NODE_ENV=staging node index.js
  microlink-api address=:::3000 node=13.14.0 environment=staging pid=28438 status=listening version=2.17.7 +0ms
Error: connect ECONNREFUSED 127.0.0.1:6379
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)

❯ npm i ioredis@4.16 && cat node_modules/ioredis/package.json | grep version
  "version": "4.16.3"

~/Projects/microlink/api next
❯ NODE_ENV=staging node index.js
  microlink-api address=:::3000 node=13.14.0 environment=staging pid=30732 status=listening version=2.17.7 +0ms

at 4.17.0, the parser thinks I'm trying to connect with a local Redis 🤔

@luin
Copy link
Collaborator

luin commented May 16, 2020

@Kikobeats Hmm...strange. It works for me:

const redis = new Redis("redis://redis-instance.ec2.cloud.redislabs.com:18529");

And ioredis does connect to redis-instance.ec2.cloud.redislabs.com instead of 127.0.0.1.

@mrspartak
Copy link

Got this error too with DigitalOcean connect string. It looks like this:
rediss://default:[password]@[host]:[port]
But without username works fine.
rediss://:[password]@[host]:[port]

Too bad it broke our containers and whole logs were spamed with NOAUTH Authentication required because we use Moleculer

@luin
Copy link
Collaborator

luin commented May 16, 2020

Fixing this with #1134. Sorry for the inconvenience and thanks for pointing this out!

@ioredis-robot
Copy link
Collaborator

🎉 This issue has been resolved in version 4.17.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Kikobeats
Copy link

Hello,

unfortunately, this is happening again in the last versions:

ioredis@4.17 -> works fine
ioredis@4.18 -> doesn't work
ioredis@4.19 -> doesn't work

.cc @luin

@AVVS
Copy link
Collaborator

AVVS commented Nov 2, 2020

@Kikobeats are you sure about 4.18? The only change in there was an update to redis-commands module, nothing that touched URI parsing code was affected.

@Kikobeats
Copy link

@AVVS Yes, I'm sure:

Screen Shot 2020-11-02 at 16 46 35

4.17 vs 4.18

@AVVS
Copy link
Collaborator

AVVS commented Nov 2, 2020

I'm not sure what the cause of this would be though - v4.17.3...c016265 is the changelog and nothing affects the parsing here

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

Successfully merging a pull request may close this issue.

6 participants