-
Notifications
You must be signed in to change notification settings - Fork 1.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
Crash on node 12 with certain Http Error Responses #2968
Comments
I should add, I'm happy to submit a PR for this if triage suggests that's the approach folks would like to take. |
@griffinmyers Thank-you for reaching out to us with your issue. Team would be happy to review the PR if it is not a breaking change. |
Thanks @ajredniwja, happy to submit a PR. To fix this, we'll need to change the value set on the // ...
try {
await sqs.sendMessage({ MessageBody: messageBody, QueueUrl: queueUrl }).promise()
} catch (e) {
if (e.name === 500) {
// log somewhere special? retry logic?
}
} From a more pragmatic view, it looks fairly unlikely that people would observe or depend on this behavior--either AWS's XML parser would need to reject, or the What do you think? |
@ajredniwja Could you perhaps review the PR I submitted to fix this bug some two weeks ago, before this issue was filed? #2963 |
@SimonWoolf I will have the team review the PR. |
It is highly unusual that an error name is set to something else than a string. This is just possible by actively manipulating the errors name in an unusual way. I suggest to consider to change the errors to a more "traditional" name and to add an extra property to the errors that contain the status code as number (e.g., |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Confirm by changing [ ] to [x] below to ensure that it's a bug:
Describe the bug
Modern versions of node (at least
>10
, confirmed onv12.13.0
) do not handleError
objects where thename
property is a non-string properly. As described in nodejs/node#30572, the following simple program will crash when running on node12.13.0
:with the message:
It turns out, the AWS SDK will set the
name
property on certain errors to be the numeric HTTP status code of a failed HTTP request/response. See lib/protocol/query.js#L55-L57 and lib/util.js#L592-L597.I can simulate this edge case with the following test program:
aws-test.js
When run on node
v10.15.1
:When run on node
v12.13.0
:Is the issue in the browser/Node.js?
Node.js
If on Node.js, are you running this on AWS Lambda?
No
Details of the browser/Node.js version
node
v12.13.0
SDK version number
v2.576.0
To Reproduce (observed behavior)
See description
Expected behavior
See description
Additional context
It looks like node is interested in patching this behavior, and I realize the core team here may not view this as something they're responsible for. Regardless, there are now published node versions that will exhibit some nasty behavior, and I think it's worth considering a fix here as well.
I also appreciate that fixing this, likely by coercing the
name
property to a string, is technically a breaking API change.The text was updated successfully, but these errors were encountered: