Bug: UnixHTTPConnectionPool Error
- Dominant language
- Python
- Stars
- 6.7k
- Forks
- 1.2k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 52
Description
Today I have updated both Docker and AWS SAM.
### Description (of `sam build --debug`):
```bash
2024-01-03 17:57:00,654 | Building to following folder /Users/bayramkuliyev/Projects/Rails/court-jobs/import_court_data/.aws-sam/build/WorkerFunction
2024-01-03 17:57:00,655 | Building image for WorkerFunction function
2024-01-03 17:58:00,660 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2024-01-03 17:58:00,666 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2024-01-03 17:58:00,667 | Unable to find Click Context for getting session_id.
Error: UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)
Traceback:
File "click/core.py", line 1078, in main
File "click/core.py", line 1688, in invoke
File "click/core.py", line 1434, in invoke
File "click/core.py", line 783, in invoke
File "samcli/cli/cli_config_file.py", line 347, in wrapper
File "click/decorators.py", line 92, in new_func
File "click/core.py", line 783, in invoke
File "samcli/lib/telemetry/metric.py", line 184, in wrapped
File "samcli/lib/telemetry/metric.py", line 149, in wrapped
File "samcli/lib/utils/version_checker.py", line 42, in wrapped
File "samcli/cli/main.py", line 95, in wrapper
File "samcli/commands/build/command.py", line 174, in cli
File "samcli/commands/build/command.py", line 263, in do_cli
File "samcli/commands/build/build_context.py", line 283, in run
File "samcli/lib/build/app_builder.py", line 219, in build
File "samcli/lib/build/build_strategy.py", line 82, in build
File "samcli/lib/build/build_strategy.py", line 92, in _build_functions
File "samcli/lib/build/build_strategy.py", line 165, in build_single_function_definition
File "samcli/lib/build/app_builder.py", line 645, in _build_function
File "samcli/lib/build/app_builder.py", line 399, in _build_lambda_image
File "samcli/local/docker/utils.py", line 91, in is_docker_reachable
File "docker/client.py", line 203, in ping
File "docker/api/daemon.py", line 166, in ping
File "docker/utils/decorators.py", line 46, in inner
File "docker/api/client.py", line 237, in _get
File "requests/sessions.py", line 602, in get
File "requests/sessions.py", line 589, in request
File "requests/sessions.py", line 703, in send
File "requests/adapters.py", line 532, in send
```
### Additional environment details
1. MacOS Sonoma 14.2.1 (23C71)
2. `sam --version`: SAM CLI, version 1.105.0
3. AWS region: `eu-central-1`
4. Docker version: `24.0.7, build afdd53b`
```
{
"version": "1.105.0",
"system": {
"python": "3.8.13",
"os": "macOS-14.2.1-arm64-arm-64bit"
},
"additional_dependencies": {
"docker_engine": "Not available",
"aws_cdk": "Not available",
"terraform": "Not available"
},
"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"
]
}
```
I think it is related to the Docker, because
1. `UnixHTTPConnectionPool` error
2. I stop the Docker, then restart , and run `sam build`. Everything works fine.
In addition to it I tried to run `sam --info` it got stuck. After I killed the Docker process completely and ran `sam --info`, it showed the info. That's why it says `"docker_engine": "Not available"`.
After I restart the Docker I run `sam build` again. It works fine. I am even able to `sam deploy` it. Next time I try to build, I get the same error.
I am not sure it is SAM CLI bug or Docker bug.
**UPDATE**
I have also noticed that the building progress like following
```bash
...
Step 1/8 : FROM public.ecr.aws/lambda/ruby:3.2
---> 74061974f58b
Step 2/8 : RUN yum install -y amazon-linux-extras ruby-devel make gcc libxml2-devel
---> Using cache
---> 69deb25d30d8
Step 3/8 : COPY Gemfile handler.rb initialize.rb ./
---> 6cdcf1d25bbe
Step 4/8 : COPY concern ./concern
---> fce6a5743a67
Step 5/8 : ENV GEM_HOME=${LAMBDA_TASK_ROOT}
---> [Warning] The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
---> Running in 2ac8aedf332b
...
```
does not appear anymore while building and only shows up when building is successful and over. In case of failure, it does not appear, only the failure msg appears.
Contributor guide
Assessment
This issue has not been assessed yet.