Comments (7)
I don't have a clue what you're talking about honestly, please provide more detail with some sort of reproducible example, without that, we can't help you.
from sqs-consumer.
Ok, so here's the zod library, which is pretty popular
Here is their ZodError implementation
For the minimal reproducible example, here's the error class with the sane idea as in ZodError:
class CustomError extends Error {
issues: string[]
constructor(issues: string[]) {
super()
this.issues = issues
}
get message() {
return this.issues.join(', ')
}
}
Now if within the handleMessage()
the error above will be thrown
throw new CustomError(['issue1', 'issue2'])
It will fail here
In these consumer.ts
lines of code
err.message =
err instanceof TimeoutError
? `Message handler timed out after ${this.handleMessageTimeout}ms: Operation timed out.`
: `Unexpected message handler failure: ${err.message}`;
So instead of "Unexpected message handler" we will receive only the error from consumer.ts
TypeError: Cannot set property message of [object Object] which has only a getter
from sqs-consumer.
Ahh I see so you're throwing a zod error and that is causing sqs-consumer to error.
Not an issue with sqs consumer itself but with the reformatting of the error from zod that was thrown, as sqs consumer is changing the property 'message' which you have pre defined as a get.
from sqs-consumer.
Zod package is commonly used to validate and add types to unknown data, which perfectly fits for SQS message body, and Zod throws its own error with getter for message
, when data was not valid.
The issue is manageable by adding try/catch wrapper for the handleMessage()
callback content.
from sqs-consumer.
Sorry not sure I explained well enough, but basically, I know what zod is, the issue here is that the error sent has a property that is only a get, which means that sqs-consumer is unable to edit the message property itself.
This removes its ability to adjust the message property and thus offer its own error functionality, you're basically overwriting that ability with this implementation.
The error being outputted is correct and is actually on your app's side, and isn't a bug with sqs-consumer itself.
from sqs-consumer.
I do not overwrite that ability in my app, it's how zod's parse()
method works.
But anyways, closing this.
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]: 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 22
- [Chore]: Update aws sdk to the latest version HOT 7
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.