Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bull
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 175
    • Issues 175
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 9
    • Merge requests 9
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OptimalBits
  • bull
  • Issues
  • #1664
Closed
Open
Issue created Mar 02, 2020 by Administrator@rootContributor

UnhandledPromiseRejection on connection error.

Created by: jan-osch

I am getting an UnhandledPromiseRejectionWarning when ECONNREFUSED is thrown on initial connection.

const Queue = require('bull');

const q = new Queue('test', 'redis://localhost:8009'); // no redis instance here

q.on('error', e => console.error('Error event', e.message));

q.process('task', 1, (job) => {
  console.log('ok');
  return Promise.resolve(job.id);
})
 .catch(error => console.error('Failed to start consumer', error.message));

I am getting this output:

Error event connect ECONNREFUSED 127.0.0.1:8009
Error event Error initializing Lua scripts
Failed to start processing connect ECONNREFUSED 127.0.0.1:8009
(node:12173) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:8009
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1137:16)
(node:12173) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:12173) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Error event connect ECONNREFUSED 127.0.0.1:8009
Error event connect ECONNREFUSED 127.0.0.1:8009

How can I handle the UnhandledPromiseRejectionWarning error ?

Assignee
Assign to
Time tracking