Queue Url differs from SQSClient endpoint message #517
-
SummaryI'm using LocalStack and have sqs-consumer pointed to my LocalStack queue for local dev work but I repeatedly get message 'QueueUrl=http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/localstack-queue differs from SQSClient resolved endpoint=https://sqs.us-east-1.amazonaws.com/, using QueueUrl host as endpoint.' Is there a way to stop this message without having to custom configure an SQSClient? ExampleNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
@jmckeeext - I recently ran into this same issue. It actually isn't coming from sqs-consumer, but instead from the AWS SDK (see: https://github.com/aws/aws-sdk-js-v3/blob/0ade74b1adcf33f36078454ce3414408afe3813b/packages/middleware-sdk-sqs/src/queue-url.ts#L66) What I did to resolve this error myself but still be able to use localstack was to do something similar to what the SDK is doing, and resolving the endpoint from the origin of the queue URL. That way, if the Queue URL is a localstack URL, it will resolve the endpoint for that client. Basically doing the same thing as Example: import { SQSClient } from '@aws-sdk/client-sqs';
import { Consumer } from 'sqs-consumer';
// Purely for demonstration... obviously these values should come from configuration
const queueUrl = 'http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/some-queue';
const consumer = new Consumer({
sqs: new SQSClient({
endpoint: new URL(queueUrl).origin,
}),
queueUrl,
// Other SQS consumer related properties here...
}); |
Beta Was this translation helpful? Give feedback.
-
Hey sorry, I didn't see this, my bad, I think usequeueurlasendpoint should be the resolution? |
Beta Was this translation helpful? Give feedback.
@jmckeeext - I recently ran into this same issue. It actually isn't coming from sqs-consumer, but instead from the AWS SDK (see: https://github.com/aws/aws-sdk-js-v3/blob/0ade74b1adcf33f36078454ce3414408afe3813b/packages/middleware-sdk-sqs/src/queue-url.ts#L66)
What I did to resolve this error myself but still be able to use localstack was to do something similar to what the SDK is doing, and resolving the endpoint from the origin of the queue URL. That way, if the Queue URL is a localstack URL, it will resolve the endpoint for that client. Basically doing the same thing as
useQueueUrlAsEndpoint
is/was doing under the covers. I suspect AWS may be deprecating this functionality in the futu…