Skip to content

fix(sqs-batch-manager): use original queueUrl instead of batchKey in batch requests#6798

Open
anuq wants to merge 3 commits intoaws:masterfrom
anuq:fix/sqs-batch-manager-queue-url-with-override-config
Open

fix(sqs-batch-manager): use original queueUrl instead of batchKey in batch requests#6798
anuq wants to merge 3 commits intoaws:masterfrom
anuq:fix/sqs-batch-manager-queue-url-with-override-config

Conversation

@anuq
Copy link
Copy Markdown

@anuq anuq commented Mar 15, 2026

Problem

Fixes #6478

When a SendMessageRequest, DeleteMessageRequest, or ChangeMessageVisibilityRequest has an overrideConfiguration set, getBatchKey() correctly returns queueUrl + overrideConfig.hashCode() as a composite key to group requests for batching. However, createXxxBatchRequest() was using this same composite string as the QueueUrl in the actual SQS API call, producing a non-existent URL like:

https://sqs.us-west-2.amazonaws.com/123/my-queue-461286369 

This causes QueueDoesNotExistException for any caller that sets an overrideConfiguration on their request — notably the SQS extended client library which appends a user-agent string via overrideConfiguration.

Fix

Extract queueUrl from identifiedRequests.get(0).message().queueUrl() (safe because all requests in a batch share the same queueUrl by the grouping invariant) and use that instead of batchKey for the QueueUrl field in the batch API call.

Affected classes:

  • SendMessageBatchManager
  • DeleteMessageBatchManager
  • ChangeMessageVisibilityBatchManager

Testing

Added regression tests to BaseSqsBatchManagerTest for all three operations that verify the WireMock-captured request body contains the original QueueUrl (not the hash-suffixed batchKey) when overrideConfiguration is set.

Checklist

  • Includes tests to exercise the new behavior
  • My code follows the code style of this project
  • Git commit message is detailed and includes context behind the change
  • Issue number is referenced (#6478)
  • I confirm that this pull request can be released under the Apache 2 license
  • Local run of ./mvnw package succeeds
…batch requests When a request has an overrideConfiguration, getBatchKey() returns queueUrl + overrideConfig.hashCode() as a composite key to correctly group requests for batching. However, createXxxBatchRequest() was passing this composite key as the QueueUrl in the actual SQS API call, producing a non-existent URL like: https://sqs.us-west-2.amazonaws.com/123/my-queue-461286369 This causes QueueDoesNotExistException for any caller that sets an overrideConfiguration on their request (e.g. the SQS extended client library which appends a user-agent via overrideConfiguration). Fix: extract queueUrl from the first request in the batch (safe because all requests in a batch share the same queueUrl by grouping invariant) and use that for the QueueUrl field in the batch API call. Affected: SendMessageBatchManager, DeleteMessageBatchManager, ChangeMessageVisibilityBatchManager. Fixes aws#6478
@anuq anuq requested a review from a team as a code owner March 15, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant