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

ErrorReply: WRONGPASS invalid username-password pair or user is disabled. #2857

Open
arunsingh28 opened this issue Oct 19, 2024 · 1 comment
Labels

Comments

@arunsingh28
Copy link

Description

I'm encountering a persistent WRONGPASS invalid username-password pair or user is disabled error when trying to connect to a Redis server using the Node.js Redis client. Despite setting the correct password for the default user and verifying it works through the Redis CLI, the connection from the Node.js application continues to fail with the same error. I've followed standard procedures for setting and verifying the password, but the issue remains unresolved.

Note: Authentication works successfully through the Redis CLI, but when attempting to connect via the Node.js application, the WRONGPASS error is thrown.

Node code

import * as redis from "redis";
import { env } from "../../config/env";

const redisClient = redis.createClient({
  url: `${env.MODE === "dev" ? "redis://" : "rediss://"}${env.REDIS_URI}`,
  socket: {
    tls: env.MODE !== "dev",
  },
});

redisClient.on("connect", () => {
  console.log(
    env.MODE === "dev" ? "connected to local redis" : "connected to AWS Valkey caches"
  );
});

redisClient.on("error", (err) => {
  console.log("error connecting to redis", err);
});

export default redisClient;

here I'm firing the server

import App from "./src/app";
import MongoDB from "./src/services/database";
import RedisClient from "./src/services/redis";

import { env } from "./config/env";

const { port } = env;

App.server.listen(port, async () => {
  MongoDB.connectDB();
  await RedisClient.connect();
  console.log(`server listening on port ${port}`);
});

this is my REDIS_URI=default:password@localhost:6379

Node.js Version

18.0.0

Redis Server Version

4.7.0

Node Redis Version

4.7.0

Platform

macOS

Logs

error connecting to redis [ErrorReply: WRONGPASS invalid username-password pair or user is disabled.]
@simplecommerce
Copy link

simplecommerce commented Jan 8, 2025

@arunsingh28 Is password your password? if not, just a note, on my end I have the same issue because = is in my password and for some reason it doesn't send it properly. I think it encodes special characters and doesn't remove the encoding before connecting. I noticed the same issue in ioredis library. Hope it helps.

UPDATE

Nevermind, I had 2 clients connecting using the same credentials and one didn't pass the correct password.

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

2 participants