Comments (7)
If any error happens within receive message then it is thrown yeah: https://github.com/bbc/sqs-consumer/blob/main/src/consumer.ts#L258
I would say it's for your app to handle those errors, I don't think we should prescribe if your app does this or that in terms of a response to this. Handling it within the library would simply hide it away, when really, you probably want to see if this has happened as it means an in flight request essentially failed.
from sqs-consumer.
I partially agree with this. What about the error
and aborted
events, shouldn't be this the centralized place on where to handle such occurences? What is the purpose of the aborted
event if we throw an error no matter what?
On top of that, the only way of catching this error is to do the following from what I understand:
process.on('uncaughtException', (err) => {
if ('code' in err && err.code === 'AbortError') {
this.logger.info('SQS listener stopped while polling for messages');
return;
}
throw err;
});
It really doesn't seem right that using a library brings to writing code like this. What do you think? How do you suggest those exceptions be handled?
from sqs-consumer.
After some additional testing, I am convinced there is another issue, perhaps not related, with the singleton instance created for the AbortController
.
When creating 2 consumers, polling the same SQS queue, and calling .stop({abort:true})
, only one consumer gets stopped and aborts its polling to SQS.
By adding a private abortController
member to each consumer instance fixes this from what I have observed in some quick testing.
from sqs-consumer.
Yeah I'm just not sure if the library hiding errors is the best way as it requires users to listen to the emitted events in order to see them.
In terms of the second thing, I would say that's an entirely different thing but it's likely because you are reusing a consumer instantiation so yeah, the abort controller wouldn't be re assigned. Only way around that would be to allow users to provide their own abort controllers or to always create a new instance of the consumer.
from sqs-consumer.
I don't think this actually hides errors. There is a clear path for the user to subscribe to all errors from this library, and I'd say I would not expect other errors to actually be thrown... What is the purpose of this error
event if not this? If you could explain the difference here, I think it would help me understand :)
For number 2, I do not think I am re-using a consumer instantiation: I am instantiating 2 distinct consumers, polling the same queue. Is this an expected behavior? Am I misunderstand the underlying concepts here?
Thank you!
from sqs-consumer.
Sorry but I'm not going to go back and forth on this, if you'd want a discussion on it head over to the discussions tab, for now, again, I don't believe there's anything we need to do here and you should handle it in your application.
In terms of the second thing, that's a different thing, needs a different issue with a reproduction.
from sqs-consumer.
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.
from sqs-consumer.
Related Issues (20)
- [Bug]: SQS receive message failed: Could not load credentials from any providers HOT 2
- [Bug]: Undocumented breaking change - acknowledgment to handleMessage HOT 7
- v5.8.0 if send message to sqs queue on other pc HOT 2
- [Bug]: ApproximateReceiveCount is not part of QueueAttributeName HOT 4
- The automated release is failing 🚨 HOT 1
- [Bug]: Version 8.1.5 of this library incompatible with @aws-sdk/client-sqs version 3.507.0 HOT 5
- Add a link to the docs at the top of the readme HOT 2
- Remove AWS SDK V2 Note
- Upgrade p-event to v6 HOT 1
- Upgrade chai to v5 HOT 1
- Remove the `handler_processing` debugger HOT 2
- [Bug]: CredentialsProviderError is not treated as a connection error HOT 2
- [Bug]: SQS receive message failed: connect ETIMEDOUT <ip>:443 every few hours HOT 4
- [Bug]: When consumer fails to react to SQS instant retry occurs HOT 3
- [Bug]: attributeNames does not support MessageSystemAttributeName HOT 3
- The automated release is failing 🚨 HOT 1
- [Bug]: When consumer fails to connect to SQS due to connectivity instant retry occurs HOT 2
- v10 isn't loading the type file correctly HOT 12
- [Feature Request]: Enhance SQSError with AWS error $response object for Better Debugging HOT 5
- [Bug]: `MaxListenersExceededWarning` when using newer AWS SDK version HOT 21
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqs-consumer.