1

I came across this change some time ago and I could not track it down to any release notes, neither Node or V8.

Until Node12, non-awaited promise was returning empty Promise {}, but since Node 14, it returns:

Promise {
  undefined,
  [Symbol(async_id_symbol)]: 51,
  [Symbol(trigger_async_id_symbol)]: 5,
  [Symbol(destroyed)]: { destroyed: false }
}

I clearly see that it was changed in Node14, as it is not present on Node 12 at all.

Does anyone know the source of this change and can point to the docs/provide any explanations to help to understand this change and its impact?

Bergi
  • 630,263
  • 148
  • 957
  • 1,375
Marek Urbanowicz
  • 12,659
  • 16
  • 62
  • 87
  • 1
    Not posting this as a full answer as I don't feel qualified and can't answer _why_, but it's added in [this commit](https://github.com/nodejs/node/commit/f37c26b8a2e10d0a53a60a2fad5b0133ad33308a) which leads to [this PR](https://github.com/nodejs/node/pull/36394). These are for NodeJS internal consumption only related to [async hooks](https://nodejs.org/dist/latest-v16.x/docs/api/async_hooks.html) so for an end user there is no impact/use. – RickN Jan 17 '22 at 13:59
  • I _believe_ this is off topic for Stackoverflow, according to SO [guidelines](https://stackoverflow.com/help/on-topic). It's a good question, but I'm not sure a request for insight/documentation on differing versions and their changes is really on topic. – Dane Brouwer Jan 17 '22 at 14:03
  • 1
    @RickN Your of course qualified to answer, and what you have done as a comment, looks good to me as an answer. – Keith Jan 17 '22 at 14:05
  • 1
    It's still the same promise. Why are you printing it to the console? – Bergi Jan 17 '22 at 15:10
  • @Bergi What is the implication? Is he not supposed to be printing a promise to the console? – 1252748 May 03 '23 at 13:17
  • @1252748 Yes, normally you'd want to print the result value to the console, i.e. `console.log(await …)` or `….then(console.log, console.error)` – Bergi May 03 '23 at 15:06

0 Answers0