Skip to main content
MediumInfo disclosureOWASP A05:2021CWE-209

How to fix: Node.js UnhandledPromiseRejectionWarning Leaked to Response

The literal text 'UnhandledPromiseRejectionWarning' was found in the response body, indicating Node.js process console output is leaking into HTTP responses.

Why it matters

This typically means console/stderr output is being mixed into the response stream (e.g. via a misconfigured process manager or a crashed dev server proxy), which can carry stack traces and internal object dumps alongside it.

UnhandledPromiseRejectionWarning is printed by Node.js to the process's stderr when a Promise rejection is never handled. It has no legitimate reason to appear inside an HTTP response body; its presence usually indicates output redirection gone wrong or a crash-and-restart loop.

How to fix it

  1. 1Add a global 'unhandledRejection' handler that logs to your normal logging pipeline, not stdout/stderr piped into the response.
  2. 2Audit every Promise-returning call in request handlers for a missing .catch() or try/catch around await.
  3. 3Verify the process manager isn't proxying raw console output into HTTP responses.

Code examples

Global unhandledRejection handler

JavaScript
process.on('unhandledRejection', (reason) => {
  logger.error('Unhandled promise rejection', reason);
});

References

Detected automatically by VulnRadar. The check id is nodejs-unhandled-rejection-exposed, stable across every scan so you can filter or diff on it.

See every info disclosure check

Questions

How severe is Node.js UnhandledPromiseRejectionWarning Leaked to Response?
VulnRadar rates this medium severity in the info disclosure category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id nodejs-unhandled-rejection-exposed, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Node.js UnhandledPromiseRejectionWarning Leaked to Response map to?
It maps to CWE-209. In the OWASP Top 10 it falls under A05:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for node.js unhandledpromiserejectionwarning leaked to response

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

Node.js UnhandledPromiseRejectionWarning Leaked to Response | VulnRadar