stephenplusplus / google-auto-auth

Making it as easy as possible to authenticate a Google API request
MIT License
34 stars 9 forks source link

work around context loss with async-listener #21

Closed ofrobots closed 7 years ago

ofrobots commented 7 years ago

async-listener is important module for APM tools and for long stack traces. Promises make the concept of a long-stack-trace ambiguous – as you can conceive the then callback as a continuation of either the resolution context or the context that queued the then callback (more details).

async-listener defaults to the resolution context. This is the wrong default for how we are using promises here, resuling in APM tools like Stackdriver Trace losing context.

We work-around the problem by not using the promise after it has resolved.

R= @matthewloring

stephenplusplus commented 7 years ago

This is some crazy stuff, but I trust you.

stephenplusplus commented 7 years ago

Out in 0.7.1.