question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ERR invalid password when the password contains a "+"

See original GitHub issue

Environment

$ node --version
v12.11.1
$ npm --version
6.11.3
$ npm view ioredis version
4.14.1

Steps to reproduce

Consider the following test:

const connStrDb0 = "redis://[CENSORED]:6380?password=9R6ocWzNBdUK7sern0BDCC72b3rceZmqyrY+BVhD1wU=&tls=true";

let redis0;

describe("Checking possibility to use the same Redis with different DBs", () => {

  beforeEach(() => {
    redis0 = new Redis(connStrDb0);
  });

  afterEach(() => {
    redis0.disconnect();
  })

  it("should be possible to set the same key on different connections", async () => {
    await redis0.set("foo", "bar0");

    expect(await redis0.get("foo")).toEqual("bar0");
  });

And run it using DEBUG=ioredis:* jest index.test.js

Expected result

The test should pass 😃

Actual result

ioredis has an issue and sends the password with the “+” changed to a space bar - logs attached

  ioredis:redis status[CENSORED:6380]: connecting -> connect +264ms
  ioredis:redis write command[CENSORED:6380]: 0 -> auth([ '9R6ocWzNBdUK7sern0BDCC72b3rceZmqyrY BVhD1wU=' ]) +1ms
  ioredis:redis write command[CENSORED:6380]: 0 -> info([]) +1ms

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
luincommented, Oct 23, 2019

I just added two test cases to address this issue: https://github.com/luin/ioredis/commit/66920f1a25b083c9d62e820215654920be3c1052.

The correct usage for passing passwords via URL is to place it in the password part (that’s user:pass@host). For your case, I think the correct way is:

redis://:9R6ocWzNBdUK7sern0BDCC72b3rceZmqyrY+BVhD1wU@[CENSORED]:6380?&tls=true

It’s supported to pass passwords via queries, but passwords need to be encoded first:

redis://[CENSORED]:6380?password=9R6ocWzNBdUK7sern0BDCC72b3rceZmqyrY%2BBVhD1wU=&tls=true
0reactions
grisha87commented, Nov 28, 2019

Thanks for the hint then!

Read more comments on GitHub >

github_iconTop Results From Across the Web

USERID OR PASSWORD CONTAINS INVALID CHARACTERS
USERID OR PASSWORD CONTAINS INVALID CHARACTERS. Reason: (VSE only) Invalid characters were found in the user ID or password fields. Action:.
Read more >
Why am I getting an "Invalid Password" error when I enter my ...
You may be entering the password incorrectly. Double check the characters before submitting the password. Also, make sure that there are no spaces...
Read more >
When connecting to Redis I get an Invalid Password error
An Invalid Password error occurs when the password being passed with the -a flag is incorrect. If you are getting this error, ...
Read more >
ORA-00988: missing or invalid password(s) - Stack Overflow
Turns out one doesn't put the password in single quotes. Double quotes are required if the password contains some special characters.
Read more >
“Password incorrect” error - Google Account Help
“Password incorrect” error · Update your app or operating system. If the app or the operating system on your device is out-of-date, you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found