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

Improve Error Handling for Large Payloads #561

Open
samirrayani opened this issue Jun 5, 2024 · 4 comments
Open

Improve Error Handling for Large Payloads #561

samirrayani opened this issue Jun 5, 2024 · 4 comments

Comments

@samirrayani
Copy link

Describe the issue
When publishing a payload via SNS (and probably SQS too) that is too large, the response should provide a better warning/message. Instead a TypeError is thrown because there is no Error message in the response

Steps to reproduce
Steps to reproduce the behavior:

  1. Create a new lambda and publish a large payload to it (arc.events.publish(...))
  2. See error that says TypeError: @aws-lite/client: SNS.Publish: Cannot read properties of null (reading 'Error')

Expected behavior
A clear message indicating why the message was unable to be processed (in our case, too big!)

Screenshots
CleanShot 2024-06-05 at 15 02 45
CleanShot 2024-06-05 at 15 03 08

@brianleroux
Copy link
Member

wow this is funny…

  • max payload size for SNS is 256KB
  • max payload size for SQS is 2GB

!!!

@samirrayani
Copy link
Author

samirrayani commented Jun 6, 2024

whoa maybe I should start using queues more? I would always just default to creating an event and add some concurrency but that's a pretty big diff

@brianleroux
Copy link
Member

Well, it depends, queues are for for when you don't want concurrency. They are designed for throttling "first in first out". An example would be you need to call an API but are rate limited to 1 request per second. If you have two users making requests one will get throttled and fail…unless if you use a queue and enqueue requests to throttle them (on your side) to 1rps.

Events are the opposite. The pattern is "fan out" when you want to 1-many broadcast as fast as possible.

@samirrayani
Copy link
Author

aha! that makes sense. thank you for the explanation 🤠

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants