-
Notifications
You must be signed in to change notification settings - Fork 30.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
process.domain is undefined after using "await" in node7 #10724
Comments
Not doced in https://github.com/nodejs/node/blob/master/doc/topics/domain-postmortem.md, however, domains are deprecated in the docs, for reasons such as this. They are known to not work with promises, though I'm having trouble finding a ref. nodejs/node-v0.x-archive#8648 discusses some issues |
We can fix this once V8 5.5 lands |
@sam-github Promise.prototype.then = function(orign){
return function(){
var d = process.domain;
var f1 = arguments[0];
var f2 = arguments[1];
if(d && typeof f1 === 'function'){
arguments[0] = d.bind(f1);
}
if(d && typeof f2 === 'function'){
arguments[1] = d.bind(f2);
}
return orign.apply(this, arguments);
}
|
This would be fixed by #12489 |
Thank you so much for fixing this. Is it gonna be released with 7.11? |
@emilsedgh Sorry, you’ll need to wait for 8.0.0 – older versions of V8 don’t have the necessary hooks for Node to handle this. edit: but just so you know, we’ll be bringing out a 8.0.0 RC very shortly – please try that out! |
Oh thank you for letting me know. Fingers crossed for 8.0! |
Thanks for fixing the issus. It works well at 8.0.0 now. |
I am trying to transform my code from Promise to await/async in node7, but I found it didn't work with
domain
.Here is my code:
As shown by the comments,
process.domain
is undefined after usingawait
. However, If I removeawait
the result will be a Promise andprocess.domain
is the same withd
.Is is a bug or something undocumented.
The text was updated successfully, but these errors were encountered: