Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Using IPv6 addresses in GATEWAY_LISTEN causes error #10874

Open
1 task done
dietrich-iti opened this issue May 23, 2024 · 2 comments
Open
1 task done

bug: Using IPv6 addresses in GATEWAY_LISTEN causes error #10874

dietrich-iti opened this issue May 23, 2024 · 2 comments
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

Comments

@dietrich-iti
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

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 script

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

GATEWAY_LISTEN=127.0.0.1,::1 localstack start -d

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

N/A

Environment

- OS: macOS Sonoma 14.4.1
- LocalStack:
  LocalStack version: 3.4.1.dev
  LocalStack Docker image sha: 53cb4b3e335239cc8542eb0fbd9a24be03c1bafecb7d003643209b39c58b9751
  LocalStack build date: 2024-04-25
  LocalStack build git hash: 9287822

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 environment localhost resolves to the IPv6 loopback address ::1, so the connection from my code to LocalStack was failing. I tried to mitigate this by using GATEWAY_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 of localhost. The other, more satisfying one was setting DOCKER_FLAGS="-p [::1]:4566:4566". That manages to make it to the place where the container is created, so it lets me use localhost 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.

@dietrich-iti dietrich-iti added status: triage needed Requires evaluation by maintainers type: bug Bug report labels May 23, 2024
@localstack-bot
Copy link
Collaborator

Welcome to LocalStack! Thanks for reporting your first issue and our team will be working towards fixing the issue for you or reach out for more background information. We recommend joining our Slack Community for real-time help and drop a message to LocalStack Pro Support if you are a Pro user! If you are willing to contribute towards fixing this issue, please have a look at our contributing guidelines and our contributing guide.

@Anze1508 Anze1508 added area: cli LocalStack CLI status: backlog Triaged but not yet being worked on platform: macos Issues related to Apple macOS and removed status: triage needed Requires evaluation by maintainers labels May 23, 2024
@MarcelStranak
Copy link

Hi @dietrich-iti,
We provide network troubleshooting guides and also GitHub Actions guide.

LocalStack only binds to IPv4 addresses (e.g. 127.0.0.1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

4 participants