-
Notifications
You must be signed in to change notification settings - Fork 982
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
Using return in Async handlers logs entire response object to stdout #1946
Comments
Is there any news on this issue? I'm considering downgrading again because of this.. :/ |
I'm experiencing the same issue. Two possible workarounds are:
|
Is it a reasonable change to test if |
On #1 here, I ran into an issue where the in-build Restify throttle uses req.log.trace and throws an error, obviously not ideal to be removing something that is expected to be there. I've restored to #2 which is not ideal. |
Restify Version: 11.1.0
Node.js Version: 19.7.0
Expected behaviour
We are upgrading from Restify 8.6.1 -> 11.1.0. In version 8.6.1, we were able to use a
return
beforeres.send
in an async handler to end the request there and then:This is especially useful in complex handlers to protect against accidental code running after a sent response.
However doing this in version 11.1.0 adds a very large console log to stdout with what looks like a response object.
I understand that calling
next
is not allowed when usingasync
functions so the return value is being passed onto the handler chain, however I would expect using areturn
here would not perform this console log. The log does not happen when using a normal function handler, so I would expect an async handler to behave the same.End the request and not perform a console log.
Actual behaviour
Logs a response object to stdout.
This message JSON ends with:
"msg": "Discarded returned value from async handler"
Logging this amount of data for each request would obviously add considerable load onto our logging systems.
Repro case
Cause
node-restify/lib/chain.js
Lines 188 to 198 in 39c1f6e
Are you willing and able to fix this?
Willing to help with guidance, but this probably needs someone who intimately understands the restify handler chain.
The text was updated successfully, but these errors were encountered: