Comments (5)
The impact of this issue is that SQS clients do not get proper errors and seem to always get a generic and undocumented error instead. Below is a simple JS script that attempts the action AmazonSQS.GetQueueUrl for a queue that does not exist. The AWS SQS endpoint results in the error type as documented but the ElasticMQ endpoint does not.
import { SQSClient, GetQueueUrlCommand, QueueDoesNotExist } from "@aws-sdk/client-sqs";
const emq_client = new SQSClient({ region: "us-east-1", endpoint: "http://localhost:9324" });
const aws_client = new SQSClient({ region: "us-east-1" });
const params = { QueueName: "no-such-queue" }
const command = new GetQueueUrlCommand(params);
async function getQueueUrl(client) {
try {
const data = await client.send(command);
console.log(data);
} catch (error) {
if (error instanceof QueueDoesNotExist) {
console.log("Got QueueDoesNotExist as expected");
} else {
console.log(error);
}
}
}
console.log("GetQueueUrl with AWS SQS");
await getQueueUrl(aws_client);
console.log("GetQueueUrl with ElasticMQ");
await getQueueUrl(emq_client);
The output for me, running ElasticMQ 1.5.1 is
GetQueueUrl with AWS SQS
Got QueueDoesNotExist as expected
GetQueueUrl with ElasticMQ
Sender: AWS.SimpleQueueService.NonExistentQueue; see the SQS docs.
at throwDefaultError (/Users/btalbot/tester/sqs-errors/node_modules/@smithy/smithy-client/dist-cjs/default-error-handler.js:8:22)
at /Users/btalbot/tester/sqs-errors/node_modules/@smithy/smithy-client/dist-cjs/default-error-handler.js:18:39
at de_GetQueueUrlCommandError (/Users/btalbot/tester/sqs-errors/node_modules/@aws-sdk/client-sqs/dist-cjs/protocols/Aws_json1_0.js:662:20)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /Users/btalbot/tester/sqs-errors/node_modules/@smithy/middleware-serde/dist-cjs/deserializerMiddleware.js:7:24
at async /Users/btalbot/tester/sqs-errors/node_modules/@aws-sdk/middleware-signing/dist-cjs/awsAuthMiddleware.js:14:20
at async /Users/btalbot/tester/sqs-errors/node_modules/@smithy/middleware-retry/dist-cjs/retryMiddleware.js:27:46
at async /Users/btalbot/tester/sqs-errors/node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js:7:26
at async getQueueUrl (file:///Users/btalbot/tester/sqs-errors/tester.mjs:12:18)
at async file:///Users/btalbot/tester/sqs-errors/tester.mjs:27:1 {
'$fault': 'client',
'$metadata': {
httpStatusCode: 400,
requestId: undefined,
extendedRequestId: undefined,
cfId: undefined,
attempts: 1,
totalRetryDelay: 0
},
__type: 'Sender'
from elasticmq.
I fixed the NonExistentQueue
error as a hotfix, however in order to completely solve the issue, the remaining errors need to be reviewed and adjusted for the new format.
from elasticmq.
Thank you. It does look like a fair amount of work to support the updated protocol
from elasticmq.
@micossow , I don't think this issue applies to just errors. I'm seeing this in successes and errors.
Are there plans to build support for elasticmq
to return http responses with content-type: x-amz-json-<version>
per the AWS SQS docs or are there any workarounds to change content-type?
I believe elasticmq
can handle requests of this content-type, but then the app still returns content-type: text/xml
. I'm using terraform to provision SQS using the mock elasticmq
, and I think current versions of the hashicorp/aws terraform provider do not handle the content type text/xml
. Terraform appears to be expecting JSON response, so it breaks when fetching state when it receives text/xml
.
from elasticmq.
@johncoleman83 can you provide an example of a specific request, that produces an invalid response and what is the expected response?
from elasticmq.
Related Issues (20)
- Publishing messages with delay does not work as expected HOT 1
- Could not find UI files error on 1.4.5-RC1 docker image HOT 2
- Fifo delay queue is delivering messages immediately instead of delaying them HOT 3
- Migrate from akka to pekko? HOT 6
- Automatic creation of queue does not work (v1.4.6) HOT 1
- IllegalArgumentException: Couldn't find header X-Amz-Target HOT 6
- AWS JSON Protocol - MessageAttributes key has appeared? HOT 3
- JSON protocol support HOT 1
- DeadLetterQueueSourceArn missing while receiving message from DLQ HOT 1
- Push images to ECR HOT 2
- Trigger Events Based on Messages in Queue HOT 4
- Exception when running routes spray.json.DeserializationException HOT 3
- "MD5 returned by SQS does not match the calculation on the original request" when using AWS JSON protocol and message attributes with custom data types HOT 1
- java.lang.IllegalArgumentException: Couldn't find header X-Amz-Target
- Cannot create Queue with AWS SDK. HOT 6
- 404s after updating AWS SDKs
- sqs: ReceiveMessageRequest.messageSystemAttributeNames has no effect? HOT 1
- Error when calling "receiveMessage" on empty queue (1.5.2, 1.6.2) HOT 1
- Crashes when SQL persistence is enabled in the `elasticmq-native` image HOT 2
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 elasticmq.