Skip to content

UnhandledPromiseRejectionWarning #1156

@penge

Description

@penge

🐛 Bug Report

While fixing the test in #1142 I have seen that request() in Transport creates a Promise that doesn't handle UnhandledPromiseRejectionWarning or in other words, doesn't handle catch

To Reproduce

'Sniff interval' on the CI randomly failed. Easiest way to reproduce this was, if I called client.info() after the shutdown().

The unhadled error looked as following:

(node:1013) UnhandledPromiseRejectionWarning: ConnectionError: connect ECONNREFUSED 127.0.0.1:40619
    at ClientRequest.<anonymous> (elasticsearch-js/lib/Connection.js:103:18)
    at ClientRequest.emit (events.js:210:5)
    at Socket.socketErrorListener (_http_client.js:406:9)
    at Socket.emit (events.js:210:5)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
    at emitUnhandledRejectionWarning (internal/process/promises.js:141:15)
    at processPromiseRejections (internal/process/promises.js:203:11)
    at processTicksAndRejections (internal/process/task_queues.js:94:32)

More in this log: https://github.com/elastic/elasticsearch-js/pull/1142/checks?check_run_id=583154405

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions