Hi,
When I tried a hello-world serverless api/lambda using chalice in windows, local execution is working fine. But when the same is pushed to Docker instance I am not able to access the same. Verified the docker connectivity using node.js app and it seems to be working fine.
Whether chalice local has any restriction on accessing from docker or some container environment?
Background- I am working on a serverless app using Chalice and NodeJs. Part of the team working on Windows and another part on MAC. The setup requires multiple settings like setting up virtual env, using vault etc. As most of the commands are using Shell scripts written in mac and facing some permissions issues in Windows, we wanted to try using Docker for running in local.
Looks like this is an issue with the listerner and host mapping. When I run chalice local --port=4000 in my local PC, the server is actually running against my localhost. where as when I run the same command I am getting a connection refused error. After searching for days, just found an article specific to this connection refused error
https://pythonspeed.com/articles/docker-connection-refused/
Here, at the last section, they mentioned about network interfaces and listening on all ports and network interfaces. Looks like my requests to the docker port is not properly reaching the chalice local instance.
After adding the host flag as 0.0.0.0 for the chalice local command, I am able to connect to the API. Posting this so that if anybody else faces the same issue, they find a solution.
command that was causing issue inside docker
chalice local --port=4000
command to use inside a docker container
chalice local --host=0.0.0.0 --port=4000
After changing the host, chalice local says running on 0.0.0.0:4000 and when the request is made to localhost:4000, log shows request handled by the docker instance's network ip(like 172.17.0.1) and responding to my requests.
Closing this as not an issue with Chalice
Closing this as not an issue with Chalice
Most helpful comment
Looks like this is an issue with the listerner and host mapping. When I run
chalice local --port=4000in my local PC, the server is actually running against my localhost. where as when I run the same command I am getting aconnection refusederror. After searching for days, just found an article specific to this connection refused errorhttps://pythonspeed.com/articles/docker-connection-refused/
Here, at the last section, they mentioned about network interfaces and listening on all ports and network interfaces. Looks like my requests to the docker port is not properly reaching the chalice local instance.
After adding the host flag as 0.0.0.0 for the chalice local command, I am able to connect to the API. Posting this so that if anybody else faces the same issue, they find a solution.
After changing the host, chalice local says running on
0.0.0.0:4000and when the request is made to localhost:4000, log shows request handled by the docker instance's network ip(like 172.17.0.1) and responding to my requests.Closing this as not an issue with Chalice