I'm trying to find the source of an unhandled rejection from a Promise in Node.js
I've tried upgrading to Node version 12, using the --async-stack-traces
option, and listening for them using:
process.on("unhandledRejection",( reason, promise ) => {
console.log(reason);
console.log(promise);
});
But I still don't see any helpful stack trace to help me find the culprit!
UnhandledPromiseRejectionWarning: TypeError: Chaining cycle detected for promise #<Promise>
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:89675) 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(). (rejection id: 11)
Running Node v10.10.0
If you miss an helpful stacktrace, you can make node create a new one by re-throwing your error in your handler like this:
process.on('unhandledRejection', (reason, p) => { throw reason });
This way, you should be able to track down the culprit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With