Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.1K
Visualizações
Redis: ERR wrong number of arguments for 'auth' command

I'm using redis with nodejs. Version: "redis": "^3.1.2"

When my server connects to redis, I get the following error:

ERR wrong number of arguments for 'auth' command

I'm guessing it has something to do with the URL, which looks like this:

redis://h:<password>@<url>:<port>

My redis is hosted by Heroku and I'm unable to change the URL. And have no idea how can I make it work. Any ideas/solutions much appreciated.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Redis Version < 6.0.0 and node-redis >=3.1.0 , redis://h:<password>@<url>:<port> will not work and throw ERR wrong number of arguments for 'auth' command.

Solution: redis://<password>@<url>:<port> works ie: remove username from the URL.

This should fix the problem that you are facing.

For other versions:

Redis Version < 6.0.0 and node-redis <=3.0.2 , redis://h:<password>@<url>:<port> works.

Redis Version >= 6.0.0 and node-redis(any version), both redis://<username>:<password>@<url>:<port>(when username in redis ACL is set to custom username) and redis://<password>@<url>:<port> will work.

The reason is:

  • node-redis made the changes to support Redis-6, as per releasenote.

  • Redis-6 supports username in ALC. Before v6, Redis did not include the notion of users, and the only authentication strategy was a single login password. Reference

  • Whenever you attach Redis addon to Heroku container, the environment variable REDIS_URL is set and the value is Connection URL of format: redis://h:<password>@<url>:<port>. This "h" is a fake/dummy/placeholder username because some clients(eg: node-redis) could not correctly handle a blank username in the URL. After the release of ACLs in Redis 6, clients began to support the new AUTH command that uses 2 arguments (username and password). Clients that attempt to pass the h username to the AUTH will result in an above error on Redis versions 4 and 5. Reference

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda