Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
My issue is described in this issue on AWS SDK v2 aws/aws-sdk-java-v2#4759
I thought it is an SDK bug as it appeared once I updated the SDK to 2.21.18 or above. But it seems that SDK works with SQS service and it is only breaking functionality when used with Localstack. I think there was a protocol change in 2.21.18 on SQS side that might not be implemented on Localstack.
This problem is now causing failures all over the SQS integration tests using Localstack.
Expected Behavior
- SQS SDK
SendMessageBatchResponse.hasFailed()
should returnfalse
when all messages were sent successfully (no failed items) -> this is returningtrue
on SDK 2.21.18+ with Localstack - SQS SDK
ReceiveMessageResponse.hasMessages()
should returnfalse
when there were no messages received -> this is returningtrue
on SDK 2.21.18+ with Localstack
How are you starting LocalStack?
Custom (please describe below)
Steps To Reproduce
How are you starting localstack (e.g., bin/localstack
command, arguments, or docker-compose.yml
)
Using TestContainers
static final LocalStackContainer localStack = new LocalStackContainer(localStackImage)
.withEnv("DYNAMODB_IN_MEMORY", "1")
.withEnv("SQS_DISABLE_CLOUDWATCH_METRICS", "1")
// Set LOCALSTACK_HOST explicitly to avoid issues running docker-in-docker in CI, where TestContainers
// might automatically try to map the dind container's hostname to it
.withEnv("LOCALSTACK_HOST", "localhost")
// Bind init scripts to localstack container
// These will ensure all necessary stacks are created before the tests run
.withCopyFileToContainer(MountableFile.forHostPath(LOCALSTACK_INIT_SCRIPT), LOCALSTACK_INIT_SCRIPT_MOUNT)
.withCopyFileToContainer(MountableFile.forHostPath(JSON_STORE_STACK_TEMPLATE), JSON_STORE_STACK_TEMPLATE_MOUNT)
.withCopyFileToContainer(MountableFile.forHostPath(ID_QUEUE_STACK_TEMPLATE), ID_QUEUE_STACK_TEMPLATE_MOUNT)
.withCopyFileToContainer(MountableFile.forHostPath(TASK_PROCESSING_QUEUE_STACK_TEMPLATE),
TASK_PROCESSING_QUEUE_STACK_TEMPLATE_MOUNT)
// Add logging to see what's happening inside the container
.withLogConsumer(new Slf4jLogConsumer(containerLog))
.waitingFor(new WaitAllStrategy()
.withStrategy(new HostPortWaitStrategy())
.withStrategy(new LogMessageWaitStrategy()
.withRegEx("localstack\\-init\\.sh finished\\R"))
.withStartupTimeout(Duration.ofMinutes(1)));
Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
For example the following fails with Localstack on 2.21.18+
but works on 2.21.17
. In both cases there are no failed items, but somehow the SDK will create a different List instance internally which causes this method to change behavior. This doesn't happen with the SQS service, only with Localstack it seems and only after AWS SDK v2 release 2.21.18
and later after the SQS protocol update.
final SendMessageBatchResponse response = sqsClient.sendMessageBatch(
SendMessageBatchRequest.builder()
.queueUrl(queueUrl)
.entries(messages)
.build()
);
assertThat(response.hasFailed()).isFalse();
Environment
- OS: Fedora 38
- LocalStack: latest docker hub image as of today (`sha256:ecae56493567b8e115b48a08e1e47a5c5961776c622254ae1eb9fb91cb9ee0ab`)
- JDK 21
- TestContainers 1.19.3
Anything else?
No response