-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Promises on prerequisites makes handler to swallow exceptions #2771
Comments
I've experienced something like this too while playing around. Possibly related to outmoded/discuss#155. |
Since I don't use promises I can't really help you. Maybe someone who knows promises well can look into it. I'll leave this open for a bit. |
@dmacosta if you put a repo up with some tests, I'll definitely take a peek. |
my gut says this is because of domains. likely something is causing the request handler's domain to get lost. |
@devinivy i'm online in gitter if you want a second pair of eyes on this when you get around to checking it out |
confirmed this is a domains issue, i think i have a fix |
ok, i don't have a fix, but i can definitely confirm it's an issue with domains.. adding logging to the error handler in that's as far as i got. domains are hard. |
Yeah, I spent about 15mins with this and didn't get far at all. The promise library used (https://github.com/then/promise) does have a note about domains in the README worth looking at. |
I'm going to label this as a bug but close it because we can't do anything about these issues. I am going to add a domains-free option soon. |
Worth adding that I revisited this. The "done" handler that hapi calls for the promise escapes the domain (i.e., |
You can now try turning off domains if you want. |
I ended up in this issue after loosing the active domain in my handlers. After some investigation I tested replacing native promises with Bluebird and it works fine. I created a gist with examples of this behaviour in case it helps someone: https://gist.github.com/rubennorte/f10d2f6ec376b28589a98bb17ef6ae85 |
Node will support domain bindings for promises, which has already been implemented in the master branch, see nodejs/node#12489. |
I've this issue when using
Promises
on a prerequisite handler and throwing an error from a handler.Replying with a literal value on the
pre()
does it make it work. Using Promises on the handler will too, but it sounds more like a workaround to me.Here's the dependencies I'm using:
I can upload an small repo with a few tests if it helps.
The text was updated successfully, but these errors were encountered: