localstack trying to connect to localhost:4566 when we explicitly have the url set to 4576
Asked Answered
U

3

7

My team is trying to get a local setup for our project. We are running the same docker-compose file with image localstack/localstack:0.8.10. We are running the same shell script. Our script looks like this...

awslocal sns subscribe \
    --topic-arn arn:aws:sns:us-east-1:123456789012:cx-clientcomm-traffic-controller-sent \
    --protocol sqs \
    --notification-endpoint http://localhost:4576/queue/cx-clientcomm-request-processor-queue

For whatever reason, two of the developers are getting this error. Could not connect to the endpoint URL: http://localhost:4566 for the SQS.

I know this port is used for the latest versions of localstack, but they're running the same image as us.

Any ideas??

Uredo answered 20/1, 2021 at 20:49 Comment(0)
L
14

It is a known issue. You need to add the following properties to the docker-compose localstack image:

  • HOSTNAME_EXTERNAL
  • hostname: localstack

So your original docker-compose will look like:

localstack:
container_name: "${LOCALSTACK_DOCKER_NAME-localstack}"
image: localstack/localstack
hostname: localstack
networks:
  - anynet
ports:
  - "4566:4566"
environment:
  - SERVICES=sqs,sns
  - DEBUG=1
  - DOCKER_HOST=unix:///var/run/docker.sock
  - HOST_TMP_FOLDER=${TMPDIR}
  - HOSTNAME_EXTERNAL=localstack
volumes:
  - ./data:/tmp/localstack
  - "/var/run/docker.sock:/var/run/docker.sock"

This will not work if you put localhost to any of these properties! You need to choose another name. I put localstack as hostname and HOSTNAME_EXTERNAL, and it worked for me.

Laughingstock answered 13/3, 2021 at 22:36 Comment(0)
O
0

If you are experiencing this issue on windows and you have docker setup to use WSL - you can just disable that and go back to using Hyper-V.

You don't need to use any special changes in the docker-compose than what is already there in the localstack github repo: https://github.com/localstack/localstack/blob/master/docker-compose.yml.

Using WSL is supposed to be faster but comes with complexities - I did not attempt to make it work any other way - it isn't worth it for me. Various searches turn up connection issues using WSL, code reverts, etc... regarding this.

Overreach answered 20/4, 2023 at 20:56 Comment(0)
C
0

You could use LocalStack desktop version

Cataphoresis answered 5/9 at 14:12 Comment(1)
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewPegmatite

© 2022 - 2024 — McMap. All rights reserved.