Open vicmosin opened 3 years ago
Thanks for reporting @vicmosin . This hostname should be resolvable, but I guess there's a few ISPs that may be blocking it from getting resolved.
Would it be an option for you to add an entry to the /etc/hosts
file?
Alternatively, you should be able to customize the API endpoint address by setting this environment variable in your LocalStack container: LOCALSTACK_HOSTNAME=127.0.0.1
. Hope that helps - please keep us posted how it goes. Thanks!
@whummer I finally had a time to check proposed solution.. Changing hosts file indeed not an option. And regarding the environment variable - can you please elaborate how exactly it must be set from the test? I tried the following way and it didn't work:
@LocalstackDockerProperties(services = [ServiceName.S3], environmentVariableProvider = DefaultEnvironmentVariableProvider::class)
...
class DefaultEnvironmentVariableProvider : IEnvironmentVariableProvider {
override fun getEnvironmentVariables(): MutableMap<String, String> =
mutableMapOf("LOCALSTACK_HOSTNAME" to "127.0.0.1")
}
Me too.
The endpoints are entered in a strange combination.
I am currently using mac os, and when connecting localstack and application through docker-compose, it is assembled as a strange endpoint.
The bucket name and the container name are concatenated with ., and the endpoint is passed, resulting in an UnknownHostException.
Especially when creating a bucket by code, an exception is thrown.
code >> amazonS3.deleteBucket(new DeleteBucketRequest(localStackProperty.bucket())); amazonS3.createBucket(new CreateBucketRequest(localStackProperty.bucket(), region));
Caused by: com.amazonaws.SdkClientException: Unable to execute HTTP request: ${bucket_name}.${containerName}
Caused by: java.net.UnknownHostException: ${bucket_name}.${containerName}
I am using
0.2.15
version of the utils. The docker starts up without any issue, but the s3 client can not resolve the url.. here is the config I have: