ioredis
ioredis copied to clipboard
Protocol error, got "H" as reply type byte.
Connecting to Redis over TLS generates:
[ioredis] Unhandled error event: ParserError: Protocol error, got "H" as reply type byte. Please report this.
at handleError (/workspaces/shop-fail/node_modules/redis-parser/lib/parser.js:190:15)
at parseType (/workspaces/shop-fail/node_modules/redis-parser/lib/parser.js:304:14)
Given redis-parser is unmaintained (for six years now), it seems counter productive to log the issue there.
This is related to https://github.com/redis/ioredis/pull/1137 I assume because it's tls requiring sni that ioredis is having the issue.
Resolved by passing servername
// Redis client configuration
const redisHost = process.env.REDIS_HOST || 'redis'
const redisPassword = process.env.REDIS_PASSWORD || ''
// is "REDIS_TLS" truthy
const redisTls: ConnectionOptions | undefined = process.env.REDIS_TLS
? { servername: redisHost }
: undefined
const redisOptions: RedisOptions = {
host: redisHost,
password: redisPassword,
tls: redisTls
}
this.redisClient = new Redis(redisOptions)