You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This causes errors that are thrown from middleware further down the chain to be swallowed due to this: restify/node-restify/issues/962
Essentially the .then(() => next()) means that the execution carries on inside the promise scope, so any errors then thrown will land in .catch(e => next(e)), but by this time the next function has already been called once and calling it again has no effect.
Resolving this I think means removing the promises or potentially something like:
I think that was my original intention. There's no reason this middleware should be special in being responsible for capturing errors down the chain in other middleware.
@mikestead I think (and just tested) the problem then is then is that nothing is handling the rejection. In this scenario, (i.e. next() throws an error), the promise that is returned from authorize will be rejected, but nothing is handling this promise so the rejection will go unnoticed.
In a way it would be better as you get the unandledRejection warning
I am actually not sure what the solution here is beyond dropping support for promise based "authorizers" and removing the promises from this function. Looking at this, it does seem there might be a bug there anyway
The authorisation middleware that is added by this module here looks like this:
This causes errors that are thrown from middleware further down the chain to be swallowed due to this: restify/node-restify/issues/962
Essentially the
.then(() => next())
means that the execution carries on inside the promise scope, so any errors then thrown will land in.catch(e => next(e))
, but by this time thenext
function has already been called once and calling it again has no effect.Resolving this I think means removing the promises or potentially something like:
The text was updated successfully, but these errors were encountered: