ioredis
ioredis copied to clipboard
Unable to connect
$ redis-cli -c -h localhost -p 6378
localhost:6378> ping
PONG
I have an SSH tunnel running to my AWS VPC, above is redis-cli running from my development machine showing that it tunnels successfully, below is my javascript code that is not running successfully but I don't know why
const Redis = require('ioredis')
const nodes = [{ host: 'localhost', port: 6378 }]
const options = {
enableOfflineQueue: false
}
const client = new Redis.Cluster(nodes, options)
// ...
it('ping should work', function () {
this.timeout(10000)
return new Promise(async (resolve, reject) => {
try {
await client.ping()
resolve()
} catch (err) {
reject(err)
}
})
})
its reporting the following error...
Error: Cluster isn't ready and enableOfflineQueue options is false
at tryConnection (node_modules/ioredis/built/cluster/index.js:599:32)
at Cluster.sendCommand (node_modules/ioredis/built/cluster/index.js:522:9)
at Cluster.ping (node_modules/ioredis/built/commander.js:122:25)
at /Users/aronlilland/Documents/dev/controlair/oauth/test/lib/cache/client.spec.js:13:22
at new Promise (<anonymous>)
at Context.<anonymous> (test/lib/cache/client.spec.js:10:12)
at processImmediate (node:internal/timers:464:21)