node-redis
node-redis copied to clipboard
cannot connect with tls to Redis Cloud
I followed both examples with the credentials generated here (tried with both "enforce client authentication" options)
I am able to successfully using redis-cli
But when I try to login using node-redis:
createClient({
url,
socket: {
tls: true,
cert: readFileSync(
'redislabs_credentials/redislabs_user.crt',
),
ca: readFileSync(
'redislabs_credentials/redislabs_ca.pem',
),
},
});
I get:
ReplyError: ERR unencrypted connection is prohibited
at parseError (/Users/mayas/bold/core/node_modules/redis-parser/lib/parser.js:179:12)
at parseType (/Users/mayas/bold/core/node_modules/redis-parser/lib/parser.js:302:14)
Environment:
- Node.js Version: 16.3
- Redis Server Version: 6.2.3
- Node Redis Version: 4.0.4
- Platform: Mac OS 11.4
@MayasHaddad did you set the url prefix to rediss ?
@gkorland yes. I set the value of url as described here
@MayasHaddad you need to add the key as well:
createClient({
url,
socket: {
tls: true,
cert: readFileSync(
'redislabs_credentials/redislabs_user.crt',
),
+ key: readFileSync(
+ 'redislabs_credentials/redislabs_user_private.key',
+ ),
ca: readFileSync(
'redislabs_credentials/redislabs_ca.pem',
),
},
});