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.47k stars 1.16k forks source link

Bug: DockerDistributionAPIError suppresses error information #5361

Closed Patman12 closed 10 months ago

Patman12 commented 1 year ago

Description:

When sam local invoke --debug fails due to an unknown Docker APIError, the only output you see is Error: Unknown API error received from docker. Since this error handling was added in v1.83.0, I reverted to v1.82.0 to investigate and noticed the error was instead Error: 500 Server Error: Internal Server Error ("Get "https://public.ecr.aws/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)").

Steps to reproduce:

Not sure how to consistently reproduce the issue, but any non-404 APIError from docker will cause sam local invoke to fail with this error

Observed result:

Only output relevant to the failure is Error: Unknown API error received from docker even with --debug set.

Expected result:

The original APIError returned from Docker should be shown in the output

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

  1. OS: macOS Monterey
  2. sam --version: 1.86.1
  3. AWS region: N/A

  "version": "1.82.0",
  "system": {
    "python": "3.11.4",
    "os": "macOS-12.6.6-x86_64-i386-64bit"
  },
  "additional_dependencies": {
    "docker_engine": "24.0.2",
    "aws_cdk": "Not available",
    "terraform": "Not available"
  }
}```
lucashuy commented 1 year ago

Hi, thanks for raising this issue! It doesn't seem like too much of an ask to include the original message in the caught message. As a general call out, we are open to contributions from the community regarding this, feel free to reach out if there any questions

github-actions[bot] commented 10 months ago

Patch is released in v1.96.0. Closing