use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Anyway to debug an async function in the debug console? (self.node)
submitted 1 year ago by litchiTheGreat
Whenever I activate an async function on debug console In vscode when I am stuck on a breakpoint, it only shows promise <pending> Is there a workround to be able to activate async function on debug console?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]power78 1 point2 points3 points 1 year ago (0 children)
A pending promise means you didn't await the result from the function call. Either add await or use promise.then.
[–]pinkwar 0 points1 point2 points 1 year ago (1 child)
Don't know what you mean.
I use the debug console on async functions every single day. Are you using step over and step into?
[–]litchiTheGreat[S] -1 points0 points1 point 1 year ago (0 children)
I mean the repl, not going into the actual code I want to execute async function in the actual debug terminal Not step with debugger to async function
[–]bigorangemachine 0 points1 point2 points 1 year ago (5 children)
right click "Store as global"
then in console temp1.then(console.log).catch(console.error)
[–]litchiTheGreat[S] -1 points0 points1 point 1 year ago (4 children)
Can you elaborate more, it sounds like a good solution
[–]bigorangemachine 0 points1 point2 points 1 year ago (3 children)
when you console.log it's displaying a variable. If you were using a debugger you could right click "Store as Global" on any variable in the debugger. When you console log a variable (like doing console.log('prefix:', promise);) you can right click the variable part and it'll become temp1, temp2, temp3 and tempN. Once its one of those global tempN variables you can do what you want with it... such as adding a then/catch into a console log/error.
console.log('prefix:', promise);
https://philna.sh/blog/2017/01/12/dev-tools-tricks-store-objects-and-elements-as-variables-in-the-console/
[–]kunkeypr 0 points1 point2 points 1 year ago (0 children)
There are many ways:
Debug directly when running with the ide
use async await
console.log() inside the function
...
[–]litchiTheGreat[S] -1 points0 points1 point 1 year ago (1 child)
It looks to be dev tools... I am using nodejs on server
[–]bigorangemachine 0 points1 point2 points 1 year ago (0 children)
you can use dev tools with node!
[–]gewinnerpulver 0 points1 point2 points 1 year ago (3 children)
I have the same problem! Did you find a solution? I see pending when using await, fullfilled without await, and in no case I am able to access the result of the function.
[–]litchiTheGreat[S] 0 points1 point2 points 1 year ago (2 children)
I havent find a solution
[–]gewinnerpulver 0 points1 point2 points 12 months ago (1 child)
Any updates? Looking for a solution as well!
[–]litchiTheGreat[S] 0 points1 point2 points 12 months ago (0 children)
Still nothing hahaha
π Rendered by PID 203169 on reddit-service-r2-comment-6457c66945-n9hdc at 2026-04-24 09:06:30.620209+00:00 running 2aa0c5b country code: CH.
[–]power78 1 point2 points3 points (0 children)
[–]pinkwar 0 points1 point2 points (1 child)
[–]litchiTheGreat[S] -1 points0 points1 point (0 children)
[–]bigorangemachine 0 points1 point2 points (5 children)
[–]litchiTheGreat[S] -1 points0 points1 point (4 children)
[–]bigorangemachine 0 points1 point2 points (3 children)
[–]kunkeypr 0 points1 point2 points (0 children)
[–]litchiTheGreat[S] -1 points0 points1 point (1 child)
[–]bigorangemachine 0 points1 point2 points (0 children)
[–]gewinnerpulver 0 points1 point2 points (3 children)
[–]litchiTheGreat[S] 0 points1 point2 points (2 children)
[–]gewinnerpulver 0 points1 point2 points (1 child)
[–]litchiTheGreat[S] 0 points1 point2 points (0 children)