bug: Using IPv6 addresses in GATEWAY_LISTEN causes error #10874
Labels
area: cli
LocalStack CLI
platform: macos
Issues related to Apple macOS
status: backlog
Triaged but not yet being worked on
type: bug
Bug report
Is there an existing issue for this?
Current Behavior
Using IPv6 address(es) in the
GATEWAY_LISTEN
environment variable causes the LocalStack CLI to crash. This appears to be due to the way HostAndPort.parse() is implemented -- it assumes that the only meaning of a colon in its input would be to separate a host and a port. Naturally this leads to trouble if I give it something like'::1'
.Expected Behavior
The CLI accepts IPv6 addresses in
GATEWAY_LISTEN
, handling them the same way it does IPv4.How are you starting LocalStack?
With the
localstack
scriptSteps To Reproduce
How are you starting localstack (e.g.,
bin/localstack
command, arguments, ordocker-compose.yml
)Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
Environment
Anything else?
I encountered this issue while trying to work around another issue:
I was setting up the LocalStack Github CI Action. I configured my code to use
http://localhost:4566
as the AWS endpoint URL, so it would talk to the port being published by the LocalStack Docker container that the CI Action sets up. Unfortunately, in that environmentlocalhost
resolves to the IPv6 loopback address::1
, so the connection from my code to LocalStack was failing. I tried to mitigate this by usingGATEWAY_LISTEN
to effectively add[::1]:4566
to the ports published by the container, which is where I discovered the problem.Ultimately I was able to find two workarounds. One was just using the IPv4 loopback address
127.0.0.1
directly, instead oflocalhost
. The other, more satisfying one was settingDOCKER_FLAGS="-p [::1]:4566:4566"
. That manages to make it to the place where the container is created, so it lets me uselocalhost
without any trouble.If it would be appropriate, I can file a separate bug for the issue of "Docker container doesn't publish its ports to IPv6" too.
The text was updated successfully, but these errors were encountered: