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
{{ message }}
This repository has been archived by the owner on Aug 20, 2020. It is now read-only.
When an Error is emitted by the http or https ClientRequest, the callback to the API method is never invoked. Thus, the caller is never informed that the request failed, and will wait forever.
In our case, a series of HTTP timeouts from the SendGrid API caused all of our asynchronous Workers to lock up waiting for responses that would never come.
There are several strategies to resolving this issue:
provide a mocked HTTP 500 response so that the callback gets a parseable Object. this could be considered a 'patch' release, since it would not crash any code which blindly expects an Object with statusCode, body and headers properties
invoke the callback with no argument, or with null. this could be thought of as breaking the API, because attempting to access a property on the non-existing Object will crash the caller. perhaps it could be excusable as a 'minor' release. also, the caller has no access to the emitted Error itself
change the callback over to CPS style -- a more traditional Node.js (err, response) argument signature -- and provide the emitted Error. this is definitely a 'major' release, but it aligns very closely with the "consistent callback function signature" approach in Promise API and consistent callback function signature sendgrid-nodejs#261
The text was updated successfully, but these errors were encountered:
cantremember
changed the title
invoke the API callback with a mocked HTTP 500 response upon Error
invoke the API callback upon Error
Sep 28, 2016
cantremember
added a commit
to cantremember/nodejs-http-client
that referenced
this issue
Sep 28, 2016
Issue Summary
When an Error is emitted by the
http
orhttps
ClientRequest, the callback to the API method is never invoked. Thus, the caller is never informed that the request failed, and will wait forever.In our case, a series of HTTP timeouts from the SendGrid API caused all of our asynchronous Workers to lock up waiting for responses that would never come.
Steps to Reproduce
In the Test Suite, use
nock
to simulate a failureInvoke the Test Case's
done
callback within the API's callback (vs. synchronously, regardless of whether the API callback is invoked or not)This will result in
Error: timeout of 2000ms exceeded
Technical details:
There are several strategies to resolving this issue:
statusCode
,body
andheaders
propertiesnull
. this could be thought of as breaking the API, because attempting to access a property on the non-existing Object will crash the caller. perhaps it could be excusable as a 'minor' release. also, the caller has no access to the emitted Error itself(err, response)
argument signature -- and provide the emitted Error. this is definitely a 'major' release, but it aligns very closely with the "consistent callback function signature" approach in Promise API and consistent callback function signature sendgrid-nodejs#261The text was updated successfully, but these errors were encountered: