Debugging with async stack traces in Node.js
See original GitHub issueThe commit d37d0fff, which fixed #542, modified Bluebird to detect when it’s running in a Chrome/Blink DevTools debugger and use a different queueing mechanism that plays well with DevTools “async stack traces” feature.
AFAICT, this does not work in DevTools provided by Node.js built-in debugger (node --inspect
):
bluebird@3.5.0
node@6.10.1
(but also8.0.0-pre
compiled locally from nodejs/node@e1d4f0ed)
It would be great to modify Bluebird to support async stack traces in Node.js too. I think this will most likely require changes in Node.js too - AFAICT, right now there is no way how to detect whether a debugger is running or not.
A sample app I am using to reproduce the problem.
'use strict';
const Promise = require('bluebird');
setInterval(tick, 500);
function tick() {
tickAsync().then(
success => console.log('PASS', success),
error => console.log('FAIL', error)
);
}
function tickAsync() {
return first().then(second).then(() => {
debugger;
return 'ok';
});
}
function first() {
return delay(10).then(() => {
console.log('first done');
});
}
function second() {
return delay(10).then(() => {
console.log('second done');
});
}
function delay(ms) {
// originally, I used setTimeout(resolve, ms)
// but it looks like setTimeout is breaking
// V8's async-stack-trace detection :(
return new Promise(resolve => resolve());
}
Async stack trace when using bluebird:

Async stack trace when I comment-out const Promise = require('bluebird')
:

Issue Analytics
- State:
- Created 6 years ago
- Comments:9
Top Results From Across the Web
Async Stack Traces in Node.js 12 | www.thecodebarbarian.com
Consider the below code. An async function run() calls another async function bar() , and bar() throws an error. What does the stack...
Read more >Incomplete async stack traces in Node.js 14.15.0 · Issue #36126
Based on the documentation I would assume that Node.js 14 does now support stack traces in async code but unfortunately node only generates ......
Read more >Debugging async operations in Node.js - LogRocket Blog
The function startTracking commences tracking of asynchronous operations. Here we pass in the doTimeout function. The async debugger invokes ...
Read more >Useful async stack traces in Node.js 14
Such a stack trace should make debugging a breeze, but, unfortunately, I have found this to work very poorly. Consider the following program:...
Read more >Debugging async code - Delicious Screencasts
Classic or "long" (async) stack traces? When your async code goes haywire, the first thing you'll likely want to zero in on is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is off-topic here.
Async stack traces are no supported on 32bit platforms because of a limitation of V8 inspector/debugger. See the discussion in https://github.com/nodejs/node/pull/13870, especially the following threads: https://github.com/nodejs/node/pull/13870#discussion_r124930411, https://github.com/nodejs/node/pull/13870#discussion_r127086782, https://github.com/nodejs/node/pull/13870#issuecomment-315126472.
https://github.com/nodejs/node is the place where to discuss this issue further.
Need help how to solve this : (node:740) [INSPECTOR_ASYNC_STACK_TRACES_NOT_AVAILABLE] Warning: Warning: Async stack traces in debugger are not available on 32bit platforms. The feature is disabled.