Skip to content

localstack SQS access broken in aws-java-sdk #3113

Description

@ta1meng

Upcoming End-of-Support

  • I acknowledge the upcoming end-of-support for AWS SDK for Java v1 was announced, and migration to AWS SDK for Java v2 is recommended.

Describe the bug

SQS access in localstack broke in aws-java-sdk 1.12.584. When I tested last week, the bug was still present in the latest version of aws-java-sdk at that time, which was 1.12.720.

As a result, we have stayed with aws-sdk-java 1.12.583.

I debugged the issue and it looks like aws-sdk-java 1.12.584+ tries to get a JSON response from localstack, but receives a text response, which is unexpected. That causes an exception because the text response cannot be parsed as a JSON.

The error is:

ERROR c.client.test.utility.SnsSqsClient$ - Unhandled exception Unable to execute HTTP request: Unexpected character ('<' (code 60))

The aws-java-sdk method that triggered the error was getQueueUrl().

image

Expected Behavior

getQueueUrl() should return the SQS queue URL.

Current Behavior

An exception was thrown if using aws-java-sdk 1.12.584+. The error logged was:

ERROR c.client.test.utility.SnsSqsClient$ - Unhandled exception Unable to execute HTTP request: Unexpected character ('<' (code 60))

Reproduction Steps

Set up localstack using docker. Create any SQS queue and try to get its URL.

Expected behavior: getQueueUrl() should return a URL such as http://localhost:4566/000000000000/local-jobs-sqs.

Bug: getQueueUrl() throws an exception and logs the reported JSON parsing error.

Possible Solution

Please review what changed in aws-sdk-java 1.12.584. One of those changes appears to be responsible for the bug.

Additional Information/Context

No response

AWS Java SDK version used

aws-sdk-java 1.12.583 vs
aws-sdk-java 1.12.584

JDK version used

OpenJDK 64-Bit Server VM Corretto-11.0.21.9.1 (build 11.0.21+9-LTS, mixed mode)

Operating System and version

MacOS Sonoma 14.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    closing-soonThis issue will close in 2 days unless further comments are made.guidanceQuestion that needs advice or information.third-partyThis issue is related to third-party libraries or applications.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions