Set HOSTNAME_EXTERNAL env variable for localstack test container
See original GitHub issueRight now localstack container does not override hostname property that leads to issues with aws responses that contains url. All works when container could be reached by localhost (127.0.0.1) but fails when running in docker env with another IP address resolved.
val sqsEndpoint = localstack.getEndpointConfiguration(SQS)
val sqsClient = AmazonSQSAsyncClient.asyncBuilder().withEndpointConfiguration(sqsEndpoint)
.withCredentials(localstack.defaultCredentialsProvider).build()
val queueUrl = sqsClient.createQueue("aQueue").queueUrl
println(sqsEndpoint.serviceEndpoint)
println(queueUrl)
This would print something like
http://127.0.0.1.nip.io:33161
http://localhost:33161/queue/aQueue
As you can see if service endpoint would be resolved to another IP it would break
Current workaround - extract host/port from serviceEndpoint info and use it in queueUrl, but as localstack can be configured to adjust host, I believe it could be done on testcontainers side
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Configuration - LocalStack Docs
Environment variables which affect LocalStack. ... Needs to be set to the network the LocalStack container is connected to if not default bridge...
Read more >localstack trying to connect to localhost:4566 when we ...
It is known issue. You need to add in docker-compose lockalstack image next properties. HOSTNAME_EXTERNAL. hostname: localstack.
Read more >LocalStack Module - Testcontainers for Java
Testcontainers will inform Localstack of the best hostname automatically, using the HOSTNAME_EXTERNAL environment variable: when running the Localstack ...
Read more >Up and Running with LocalStack and Docker Compose
LocalStack is a “fully functional local AWS cloud stack” which lets ... and set an HOSTNAME_EXTERNAL environment variable if you need to:.
Read more >Dockercompose: How To Access Localstack Resources Both ...
LocalStack provides an easytouse test/mocking framework for developing Cloud ... In this dockercompose.yml we set the environment variable SERVICES to the ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I believe the fix by @CauchyPeano should be merged. Spent half of the day trying to figure out whats wrong.
fixed in https://github.com/testcontainers/testcontainers-java/pull/1891