Skip to content
Latchkey

Redis "NOAUTH Authentication required" (requirepass) in CI

The Redis service was started with a password (requirepass or REDIS_PASSWORD) and your client sent a command before authenticating. Redis rejects every command with "NOAUTH Authentication required." until the client runs AUTH.

What this error means

Every Redis command in CI fails with "NOAUTH Authentication required." even though the connection succeeds, because the service enforces a password the client did not send.

redis-cli
(error) NOAUTH Authentication required.
# from a client:
redis.exceptions.AuthenticationError: Authentication required.

Common causes

The service sets a password the client does not send

The redis image was configured with --requirepass or REDIS_PASSWORD, but the client URL or config has no password, so AUTH never runs.

Password set in service but not exposed to tests

The workflow defines the password on the service but does not pass the same value into the test environment, so the client connects anonymously.

How to fix it

Send the same password the service requires

  1. Set the password once and reference it in both the service and the client env.
  2. Put the password in the connection URL or pass -a to redis-cli.
  3. Confirm with an authenticated PING.
.github/workflows/ci.yml
services:
  redis:
    image: redis:7
    options: --requirepass ${{ secrets.REDIS_PASSWORD }}
    ports: ['6379:6379']
env:
  REDIS_URL: redis://:${{ secrets.REDIS_PASSWORD }}@localhost:6379

Authenticate redis-cli explicitly

Pass the password with -a (or run AUTH first) so commands are permitted.

Terminal
redis-cli -h localhost -p 6379 -a "$REDIS_PASSWORD" ping

How to prevent it

  • Define the Redis password once and reuse it for service and client.
  • Keep the password in a CI secret, not in committed config.
  • Verify with an authenticated PING before running tests.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →