SQS Error handling #3563
Replies: 5 comments
-
@fabian-grajko thanks for opening this, transferred it to the correct repo. Can you please share the specific code that you are using? |
Beta Was this translation helpful? Give feedback.
-
Sure. I reproduced the error using const { SQSClient, SendMessageCommand } = require('@aws-sdk/client-sqs');
const client = new SQSClient({
endpoint: 'http://localhost:4566',
region: 'us-east-2',
});
const command = new SendMessageCommand({
QueueUrl: 'http://localhost:4566/000000000000/test.fifo',
MessageBody: undefined, // This line is causing problem
MessageGroupId: '1',
});
client.send(command).then(console.log).catch(console.error); Output:
|
Beta Was this translation helpful? Give feedback.
-
@fabian-grajko I get it now, just in general not a good idea to pass |
Beta Was this translation helpful? Give feedback.
-
If |
Beta Was this translation helpful? Give feedback.
-
I also have this issue when sending const request: DeleteMessageBatchRequest = {
QueueUrl: queueUrl,
Entries: [{Id: 'msg1', ReceiptHandle: 'not-found'}]
};
const command = new DeleteMessageBatchCommand(request);
await this.client.send(command); // Throws "Cannot read property 'Code' of undefined" It also occurs in |
Beta Was this translation helpful? Give feedback.
-
Confirm by changing [ ] to [x] below to ensure that it's a bug:
Describe the bug
SQSClient throws
TypeError
when Command input is incorrectIs 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
v14.16.1
SDK version number
"@aws-sdk/client-sqs": "3.18.0"
To Reproduce (observed behavior)
.send()
invalid commandExpected behavior
A valid error is thrown.
Additional context
I tested it with
SendMessageBatchCommand
andSendMessageCommand
Beta Was this translation helpful? Give feedback.
All reactions