aws / aws/aws-sdk-java-v2

SQS Request Queue URL Incorrect When using Batch Manager with a client having Override Configuration on request

Open
#6,478 3 comments 0 reactions 0 assignees View on GitHub
bug p2 sqs-batch-manager
Dominant language
Java
Stars
2.6k
Forks
1k
Avg merge
2d 9h
Merged PRs (30d)
51

Description

### Describe the bug

Looking through the code, it looks like if the batch manager is created with an SQS client that has an override configuration, it sets the `queueUrl` as the `batchKey`.
https://github.com/aws/aws-sdk-java-v2/blob/master/services/sqs/src/main/java/software/amazon/awssdk/services/sqs/internal/batchmanager/SendMessageBatchManager.java#L100

This happens for all SQS request types (Send Message, Change Message Visibility, etc...)

The `batchKey` is the original queue URL plus the override configuration hash code appended.

For example:

Original Queue URL:
```
https://sqs.us-west-2.amazonaws.com/487219371131/queue-name
```

Resulting Queue URL (Batch Key):
```
https://sqs.us-west-2.amazonaws.com/487219371131/queue-name-126351273
```

@joviegas looks like this code was implemented by you.

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Expected Behavior

The Queue URL should not be changed.

### Current Behavior

The request errors with "Queue Does Not Exist:

```
software.amazon.awssdk.services.sqs.model.QueueDoesNotExistException
```

### Reproduction Steps

Create a batch manager, and pass it an SQS client. Call the `sendMessage` with an override configuration.

```java
SqsAsyncClient asyncClient = SqsAsyncClient.create();

SqsAsyncBatchManager batchManager = asyncClient.batchManager();

SendMessageRequest request = SendMessageRequest.builder()
.queueUrl("https://sqs.us-west-2.amazonaws.com/487219371131/queue-name")
.messageBody("Hello")
.overrideConfiguration(...)
.build();

batchManager.sendMessage(request);

```

This behavior was noticed when using the SQS exended client implementation:
- https://github.com/awslabs/amazon-sqs-java-extended-client-lib/blob/master/src/main/java/com/amazon/sqs/javamessaging/AmazonSQSExtendedAsyncClient.java#L534
- https://github.com/awslabs/amazon-sqs-java-extended-client-lib/blob/master/src/main/java/com/amazon/sqs/javamessaging/AmazonSQSExtendedClientUtil.java#L131-L139

The lines above appends a user agent (updates override configuration).

### Possible Solution

Set the `queueUrl` as the original queue url, not the `batchKey`? I'm not sure of the consequences, though.

### Additional Information/Context

_No response_

### AWS Java SDK version used

2.33.4

### JDK version used

21

### Operating System and version

Darwin 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:40 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6041 arm64

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.