aws / aws-sam-cli

CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM
https://aws.amazon.com/serverless/sam/
Apache License 2.0
6.51k stars 1.17k forks source link

Bug: `sam local invoke --docker-network host` fails if port 8080 is already in use in host #6347

Closed gastonsilva closed 11 months ago

gastonsilva commented 11 months ago

Description:

sam local invoke --docker-network host fails if port 8080 is already in use in host

Steps to reproduce:

1- Start something in host listening on port 8080 (Ex: nc -l localhost 8080) 2- Run sam local invoke --docker-network host ...

Observed result:

2023-11-27 13:05:49,262 | Mounting /tmp/tmp8ln7f_k_ as /var/task:ro,delegated, inside runtime container
27 Nov 2023 16:05:49,767 [PANIC] (rapid) listen tcp 0.0.0.0:8080: bind: address already in use
panic: (*logrus.Entry) 0xc0001e81c0

Expected result:

N/A

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: Ubuntu 22.04.3 LTS
  2. sam --version: 1.86.1
  3. AWS region: N/A
{
  "version": "1.86.1",
  "system": {
    "python": "3.11.3",
    "os": "Linux-6.3.2-060302-generic-x86_64-with-glibc2.35"
  },
  "additional_dependencies": {
    "docker_engine": "24.0.7",
    "aws_cdk": "2.110.1 (build 0d37f0d)",
    "terraform": "1.6.4"
  },
  "available_beta_feature_env_vars": [
    "SAM_CLI_BETA_FEATURES",
    "SAM_CLI_BETA_BUILD_PERFORMANCE",
    "SAM_CLI_BETA_TERRAFORM_SUPPORT",
    "SAM_CLI_BETA_RUST_CARGO_LAMBDA"
  ]
}
github-actions[bot] commented 11 months ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.