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
- 1Add a global 'unhandledRejection' handler that logs to your normal logging pipeline, not stdout/stderr piped into the response.
- 2Audit every Promise-returning call in request handlers for a missing .catch() or try/catch around await.
- 3Verify the process manager isn't proxying raw console output into HTTP responses.
Code examples
Global unhandledRejection handler
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.
More info disclosure checks
- MediumRails Session Cookie Missing HttpOnly Flag
- InfoServer header truncated
- InfoPHP session cookie naming exposes runtime
- Infoconfig.js / settings.js referenced (verify contents)
- Infoenv.js / environment.js referenced (verify contents)
- InfoSitemap.xml publicly accessible
- InfoOpenAPI schema version exposed in URL
- LowCORS exposes internal CDN hostname
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.