Thanks for the update!

As for Promise.resolve(), you’re right. It’s a synchronous function which immediately creates a resolved Promise object. That’s why Async Hooks won’t work with Promise.resolve() only. But when you chain a then() for this object, an async promise microtask is created and this microtask is an async resource from Async Hooks API perspective.

As for the workaround, I agree that it doesn’t make sense to use Async Hooks when you have to “drag” metadata all across your invocations. It’s purpose to avoid boilerplate code duplication.

Could you describe the goal you’re trying to achive with Async Hooks? It may help me with suggesting one or another way to achieve it.

Software engineer at Hazelcast. Node.js core collaborator. Architectural design and challenging problems are the things that I love in IT.

Software engineer at Hazelcast. Node.js core collaborator. Architectural design and challenging problems are the things that I love in IT.