Unhandled error event: Error: connect ECONNREFUSED
See original GitHub issueHi,
I have some code similar to this:
async function bootStrap () {
await redis.connect();
// ...other things
}
bootStrap()
.catch(err => {
console.log('-------------');
console.log(err);
console.log('-------------');
process.exit(1);
});
The problem is that, when the Redis server is not connected, this code produces:
[ioredis] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:6379
at Object.exports._errnoException (util.js:1033:11)
at exports._exceptionWithHostPort (util.js:1056:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1099:14)
-------------
Error: Connection is closed.
at Redis.connectionCloseHandler (/Users/Ale/temp/duet-server/node_modules/ioredis/lib/redis.js:312:16)
at Object.onceWrapper (events.js:293:19)
at emitOne (events.js:96:13)
at Redis.emit (events.js:191:7)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
-------------
Why does it have the Unhandled error event
at the beginning? Shouldn’t that be passed to the rejected promise on redis.connect()
?
Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Error: connect ECONNREFUSED 127.0.0.1:6379 · Issue #369 ...
i try run laravel-echo-server start but i have error like this ... [ioredis] Unhandled error event: Error: connect ECONNREFUSED ...
Read more >Unhandled error event: Error: connect ECONNREFUSED
I'm using pm2 to ensure laravel-echo-server is running. Performing a pm2 logs 0 gives me some errors. I'm running the server on a...
Read more >Specker server running error - Developers - Speckle Community
I am following steps from this Local development environment | Speckle Docs to run speckle server. I am getting below error.
Read more >error: connect econnrefused 127.0.0.1:6379 at ... - You.com
[ioredis] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:6379 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1247:16).
Read more >connect ECONNREFUSED 127.0.0.1:3306 solved in Node JS ...
How to fix Error : connect ECONNREFUSED 127.0.0.1:3306 in node js and mysql is shown.
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
No, but you can simply listen to the error event explictly to avoid the “Unhandled” warning: