Skip to content

[BUG] Redis auth attempted with unset credentials when REDIS_URI is absent #541

@Justxd22

Description

@Justxd22

Describe the bug
Nostream attempts Redis authentication even when no Redis credentials are configured, causing WRONGPASS on local Redis instances that allow unauthenticated access.

src/cache/client.ts:

export const getCacheConfig = (): RedisClientOptions => ({
  url: process.env.REDIS_URI
    ? process.env.REDIS_URI
    : `redis://${process.env.REDIS_USER}:${process.env.REDIS_PASSWORD}@${process.env.REDIS_HOST}:${process.env.REDIS_PORT}`,
  password: process.env.REDIS_PASSWORD,
})

notice how it uses process.env.REDIS_PASSWORD even when it's empty/unset or null, resulting in failed connection due to broken URI

To Reproduce

  1. Configure .env with only:
REDIS_HOST=localhost
REDIS_PORT=6379
  1. Start nostream pnpm run dev and trigger a redis operation like visiting 127.0.0.1:8008/invoices
  2. Observe repeated Redis connection/auth errors.

Expected behavior
If credentials REDIS_PASSWORD are unset, nostream should connect to Redis without AUTH.

System (please complete the following information):

  • OS: Arch linux
  • Platform: pnpm
  • Version: latest

Logs

uncaught error: [ErrorReply: WRONGPASS invalid username-password pair or user is disabled.]
uncaught error: [ErrorReply: WRONGPASS invalid username-password pair or user is disabled.]
uncaught error: [ErrorReply: WRONGPASS invalid username-password pair or user is disabled.]
uncaught error: [ErrorReply: WRONGPASS invalid username-password pair or user is disabled.]
uncaught error: [ErrorReply: WRONGPASS invalid username-password pair or user is disabled.]
uncaught error: [ErrorReply: WRONGPASS invalid username-password pair or user is disabled.]
uncaught error: [ErrorReply: WRONGPASS invalid username-password pair or user is disabled.]
uncaught error: [ErrorReply: WRONGPASS invalid username-password pair or user is disabled.]
uncaught error: [ErrorReply: WRONGPASS invalid username-password pair or user is disabled.]

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions