Skip to content
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

[Feature Request]: Enhance SQSError with AWS error $response object for Better Debugging #495

Closed
nirf opened this issue May 6, 2024 · 5 comments · Fixed by #496
Closed

Comments

@nirf
Copy link

nirf commented May 6, 2024

Describe the bug

Description:
Currently, when an error occurs in the deleteMessage method of the sqs-consumer npm library, the thrown error from AWS includes a $response object which is crucial for debugging. However, this $response object is not accessible through the SQSError, which makes it challenging to understand the underlying issue, especially in cases of deserialization errors.

Error message example: "SQS delete message failed: Unexpected token < in JSON at position 0\n Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object."

For instance, if the SQS deleteMessage operation fails due to an unexpected token in the JSON (e.g., "Unexpected token < in JSON at position 0"), the raw response from AWS could provide critical insights into what went wrong. Unfortunately, without access to the $response object, developers are left guessing, potentially leading to increased debugging time and slower resolution.

Proposal:
Extend the SQSError class to include the $response object from AWS errors. This enhancement would allow developers to inspect the raw AWS response directly from the SQSError instance, facilitating quicker and more effective troubleshooting.

Impact:
Incorporating the $response object into SQSError would significantly improve the developer experience by providing more detailed error contexts directly, aiding in faster bug resolutions and reducing downtime in production environments.

Thanks

Your minimal, reproducible example

https://gist.github.com/nirf/f2ac58f2a6a837d4f3a55d491a395dab

Steps to reproduce

update the toSQSError function

Expected behavior

access to the aws error $response object for better debugging

How often does this bug happen?

Often

Screenshots or Videos

No response

Platform

Node version - 18.12.1

Package version

7.5.0

AWS SDK version

3.428.0

Additional context

Great Library :-)

@nicholasgriffintn nicholasgriffintn changed the title [Bug]: Enhance SQSError with AWS error $response object for Better Debugging [Feature Request]: Enhance SQSError with AWS error $response object for Better Debugging May 6, 2024
@nicholasgriffintn nicholasgriffintn added feature-request feature request and removed bug labels May 6, 2024
@nicholasgriffintn
Copy link
Member

Hey, thanks for raising this issue!

This makes a lot of sense, not sure why we don't already really.

@nicholasgriffintn
Copy link
Member

I've popped an initial mock up here: #496

This keeps the error object the same as it is today by default but adds a new option that will extend the output with both response and metadata, so best of both worlds.

Copy link

github-actions bot commented May 8, 2024

🎉 This issue has been resolved in version 10.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@nirf
Copy link
Author

nirf commented May 21, 2024

Thanks 👍

Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants