node-redis: WRONGPASS invalid username-password pair
Issue
Hi, I wish I had more time to fill this out but I’m making this for others who are having this issue. Our Node applications started crashing on startup when we updated (without realizing) to 3.1.0. Thankfully this only happened on our stage servers so no harm was done! But hopefully, others find this helpful!
The error is as follows
ReplyError: WRONGPASS invalid username-password pair
at parseError (redacted.../node_modules/redis/node_modules/redis-parser/lib/parser.js:179:12)
at parseType (redacted.../node_modules/redis/node_modules/redis-parser/lib/parser.js:302:14) {
command: 'AUTH',
args: [ 'redacted', 'redacted' ],
code: 'WRONGPASS'
}
The username-password pair is correct and works before 3.1.0 to fix this for now we downgraded to 3.0.2
Environment
- Node.js Version: 14.15.4
- Redis Version: Unkown (I can add once I find out)
- Platform: MacOS 11.0.1, Heroku Node, Arch Linux
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 33 (1 by maintainers)
@darklight147 try to change the “username” to “default”
@lebseu @darklight147 are you using the default user or a custom ACL user? If you’re using the default user, make sure the set the username to “default” or just leave it empty.
@bamse16 using
redis://:password@localhost:6379should do the trick. @nbasili you should try without the usernameh-->redis://:<password>@<host>:<port>Heroku deployments are broken at
3.1.0, initializing the client using:where
REDIS_URLis set automatically by Heroku using the formatredis://h:<password>@<host>:<port>The error is:
This renders the latest version unusable on Heroku, everything is working fine at
3.0.2though.We just encountered the same issue, fortunately on the staging server. Shouldn’t it have been a major version change? I just ran
npm updateand boom everything broke.I have the same issue as @darklight147. Setting the username to
redis://default:password@ipor empty stringredis://:password@ipdoes not help.The only thing that helps is setting the connection string as
redis://password@ip, nousername:part.When a username is present, even if named
default, the auth command is sent asauth 'default', 'password'and redis 3.0.6 rejects that.Edit: The error I get is:
Redis connection error: ReplyError: ERR wrong number of arguments for 'auth' command..@darklight147 until version 3.1.0 the username part was ignored, so please try to set it to “default” (or leave it empty) and check if that’s help
just installed the latest version 4.0.0 using
“URI”: "rediss://password@url:port did not work “URI”: "rediss://default:password@url:port did not work “URI”: "rediss://admin:password@url:port did not work
“URI”: "rediss://:password@url:port did work just putting : before password
is this the new behaviour ?
For anyone with an old redis installation on Heroku, this will solve the issue (node-redis 3.1.2):
I’ve tried
redis://:password@localhost:6379and that works for me as well. Previously, a package that was parsing the URI would not handle empty username, so that was not related to this package.+1 - Like @eiskalteschatten we use the heroku redis add-on so the URL is managed by them.
I’m not inclined to create a brittle solution of modifying the URL to remove the username at runtime.
This really should’ve been mentioned in the release notes.
Maan, thank you so muuuuch
We’re having this issue as well. Like others said, 3.0.2 resolves it for us. We’re reading the redis connection string from whatever the cloud environment gives us, which for right now is
rediss://<username>:<password>@<ip>:<port>The error we got was ‘wrong number of arguments for ‘auth’ command’.
Looks like Heroku fixed this for newly created Redis add-ons: https://devcenter.heroku.com/changelog-items/1932