start-api debug port failure
dpancu opened this issue · 1 comments
Description:
When running the command sam local start-api -t template.yaml -d 5858 on macOS Sonoma 14.5, an error occurs indicating that the port 5858 is already allocated, despite verifying that the port is not in use. The API starts and works correctly when the -d 5858 option is omitted.
Steps to reproduce:
- Use macOS Sonoma 14.5.
- Ensure the port 5858 is not in use.
- Run the command:
sam local start-api -t template.yaml -d 5858.
Observed result:
driver failed programming external connectivity on endpoint nostalgic_poincare (c075a12c9021eda5a9113d79125cbead2fa45163ea3d5578294f90edcd504112): Bind for 127.0.0.1:5858 failed: port is already allocated
Expected result:
The API should start without any port allocation issues when the -d 5858 option is used.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: macOS Sonoma 14.5
- SAM CLI, version 1.121.0
- OS:
sam --version
:- AWS region:
{
"version": "1.121.0",
"system": {
"python": "3.12.4",
"os": "macOS-14.5-arm64-arm-64bit"
},
"additional_dependencies": {
"docker_engine": "27.1.1",
"aws_cdk": "Not available",
"terraform": "1.5.7"
},
"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"
]
}
Add --debug flag to command you are running
2024-08-03 21:53:45,731 | Mounting /Users/pancudaniel/workspace/aws-lambda-local/hello_world as /var/task:ro,delegated, inside runtime container
2024-08-03 21:53:45,811 | Exception raised during the execution
2024-08-03 21:53:45,811 | Lambda functions containers initialization failed because of 500 Server Error for
http+docker://localhost/v1.35/containers/1407b94c49ad63d28458ad21d8f7ebc80a9082bd2806a74ee74c3dd15b9032f1/start: Internal Server Error ("driver failed programming external connectivity on endpoint pensive_borg
(7edee39c7333abd0e59e285b0f9521a5891c0fdd469a864c11928cd0ee660ae1): Bind for 127.0.0.1:5858 failed: port is already allocated")
2024-08-03 21:53:45,813 | Terminating all running warm containers
2024-08-03 21:53:45,813 | Terminate running warm container for Lambda Function 'HelloWorldFunction'
2024-08-03 21:53:45,822 | Cleaning all decompressed code dirs
2024-08-03 21:53:45,837 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2024-08-03 21:53:45,880 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2024-08-03 21:53:45,881 | Unable to find Click Context for getting session_id.
2024-08-03 21:53:45,881 | Sending Telemetry: {'metrics': [{'commandRun': {'requestId': '16d4da3f-3df8-4ae7-92b8-2d4db4fdc9e4', 'installationId': '638b326b-3acc-4f39-aeda-926912afbf5b', 'sessionId':
'ee4c22e1-50f7-4daf-be05-da49dec04a79', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.12.4', 'samcliVersion': '1.121.0', 'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '',
'commandName': 'sam local start-api', 'metricSpecificAttributes': {'projectType': 'CFN', 'gitOrigin': None, 'projectName': '335f8699a0b4c39966b759c1940e9fbb9f5bfc83c6eb3ca4601b9a9205fece6d', 'initialCommit':
None}, 'duration': 3812, 'exitReason': 'ContainersInitializationException', 'exitCode': 1}}]}
2024-08-03 21:53:45,883 | Sending Telemetry: {'metrics': [{'events': {'requestId': '2f0b9910-bec5-4848-a1c7-365f90be817c', 'installationId': '638b326b-3acc-4f39-aeda-926912afbf5b', 'sessionId':
'ee4c22e1-50f7-4daf-be05-da49dec04a79', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.12.4', 'samcliVersion': '1.121.0', 'commandName': 'sam local start-api', 'metricSpecificAttributes':
{'events': [{'event_name': 'SamConfigFileExtension', 'event_value': '.toml', 'thread_id': '7ecd6f72872248bc866f715a160bd2a5', 'time_stamp': '2024-08-03 18:53:42.007', 'exception_name': None}, {'event_name':
'SamConfigFileExtension', 'event_value': '.toml', 'thread_id': '788ea714e26940e88ff8cba5ab949532', 'time_stamp': '2024-08-03 18:53:42.024', 'exception_name': None}]}}}]}
2024-08-03 21:53:46,445 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
Error: Lambda functions containers initialization failed
2024-08-03 21:53:46,457 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
2024-08-03 21:53:46,554 | Terminating all running warm containers
2024-08-03 21:53:46,555 | Terminate running warm container for Lambda Function 'HelloWorldFunction'
2024-08-03 21:53:46,662 | Cleaning all decompressed code dirs
⚠️ 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.