ioredis won't throw errors, prints to console instead - Unhandled error event: Error: connect ECONNREFUSED
See original GitHub issueError handling seems to be broken when trying to query a non-existent database. To reproduce:
const Redis = require('ioredis');
const settings = {
host: "localhost",
port: 1234 // any invalid port
};
const redis = new Redis(settings);
(async function() {
try {
await redis.info()
} catch (err) {
// no error is caught, ioredis prints straight to console
console.log("caught: ", err)
}
})()
Results in console getting flooded with:
[ioredis] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:6379
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
Version 4.19.2
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:6
Top Results From Across the Web
[ioredis] unhandled error event: error: connect econnrefused ...
luin/ioredisioredis won't throw errors, prints to console instead - Unhandled error event: Error: connect ECONNREFUSED#1235. Created about 2 years ago.
Read more >node.js - Unable to handle this error gracefully - Stack Overflow
I tried to put my code in try catch but unfortunately redis is not throwing exception and unable to catch the exception in...
Read more >AWS Lambda function errors in Node.js
This page describes how to view Lambda function invocation errors for the Node.js runtime using the Lambda console and the AWS CLI.
Read more >Redis with Node.js (ioredis) | Redis Documentation Center
This example shows how to configure ioredis to make a connection to Redis using TLS ... [ioredis] Unhandled error event: ReplyError: NOPERM this...
Read more >nodejs-api/ errors
console.error(err); }); connection.pipe(process.stdout);. A handful of typically asynchronous methods in the Node.js API may ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The proposed solution in #1209 seemed to resolve this for me.
Experiencing the same issue, tried passing a reconnectOnError function but no use