aws / aws-cli

Universal Command Line Interface for Amazon Web Services
Other
15.09k stars 4.01k forks source link

aws cli can't connect to any region/endpoint and throws Bad file descriptor #8741

Closed ChristianSch closed 4 days ago

ChristianSch commented 2 weeks ago

Describe the bug

Running any command I tried (i.e. s3 ls, ecr get-authorization-token) fails.

Expected Behavior

I can connect to AWS.

Current Behavior

~ >>>  aws ecr get-authorization-token --debug                                                2522ms  Thu Jun 13 09:08:50 2024
2024-06-13 09:18:16,163 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/2.16.7 Python/3.11.9 Darwin/23.5.0 source/arm64
2024-06-13 09:18:16,163 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['ecr', 'get-authorization-token', '--debug']
2024-06-13 09:18:16,187 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_s3 at 0x103764400>
2024-06-13 09:18:16,187 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_ddb at 0x10357ad40>
2024-06-13 09:18:16,187 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <bound method BasicCommand.add_command of <class 'awscli.customizations.configure.configure.ConfigureCommand'>>
2024-06-13 09:18:16,187 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function change_name at 0x1031934c0>
2024-06-13 09:18:16,187 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function change_name at 0x1031b8b80>
2024-06-13 09:18:16,187 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function alias_opsworks_cm at 0x10377c4a0>
2024-06-13 09:18:16,187 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_history_commands at 0x1035d6160>
2024-06-13 09:18:16,187 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <bound method BasicCommand.add_command of <class 'awscli.customizations.devcommands.CLIDevCommand'>>
2024-06-13 09:18:16,187 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_waiters at 0x103767420>
2024-06-13 09:18:16,187 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <bound method AliasSubCommandInjector.on_building_command_table of <awscli.alias.AliasSubCommandInjector object at 0x103842050>>
2024-06-13 09:18:16,187 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/data/cli.json
2024-06-13 09:18:16,188 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_types at 0x1036960c0>
2024-06-13 09:18:16,188 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function no_sign_request at 0x1036963e0>
2024-06-13 09:18:16,188 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_verify_ssl at 0x103696340>
2024-06-13 09:18:16,188 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_cli_read_timeout at 0x103696520>
2024-06-13 09:18:16,188 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_cli_connect_timeout at 0x103696480>
2024-06-13 09:18:16,188 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <built-in method update of dict object at 0x10383b340>
2024-06-13 09:18:16,188 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/2.16.7 Python/3.11.9 Darwin/23.5.0 source/arm64
2024-06-13 09:18:16,188 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['ecr', 'get-authorization-token', '--debug']
2024-06-13 09:18:16,188 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_timestamp_parser at 0x103764e00>
2024-06-13 09:18:16,188 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function register_uri_param_handler at 0x102fafd80>
2024-06-13 09:18:16,188 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_binary_formatter at 0x103800f40>
2024-06-13 09:18:16,188 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function no_pager_handler at 0x102e63560>
2024-06-13 09:18:16,188 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_assume_role_provider_cache at 0x102fb7c40>
2024-06-13 09:18:16,189 - MainThread - botocore.utils - DEBUG - IMDS ENDPOINT: http://169.254.169.254/
2024-06-13 09:18:16,192 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function attach_history_handler at 0x1035d5940>
2024-06-13 09:18:16,192 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_json_file_cache at 0x10320ede0>
2024-06-13 09:18:16,198 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/data/ecr/2015-09-21/service-2.json
2024-06-13 09:18:16,200 - MainThread - botocore.hooks - DEBUG - Event building-command-table.ecr: calling handler <function _inject_commands at 0x1035ecea0>
2024-06-13 09:18:16,200 - MainThread - botocore.hooks - DEBUG - Event building-command-table.ecr: calling handler <function add_waiters at 0x103767420>
2024-06-13 09:18:16,205 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/data/ecr/2015-09-21/waiters-2.json
2024-06-13 09:18:16,205 - MainThread - botocore.hooks - DEBUG - Event building-command-table.ecr: calling handler <bound method AliasSubCommandInjector.on_building_command_table of <awscli.alias.AliasSubCommandInjector object at 0x103842050>>
2024-06-13 09:18:16,205 - MainThread - awscli.clidriver - DEBUG - OrderedDict([('registry-ids', <awscli.arguments.ListArgument object at 0x1039b3650>)])
2024-06-13 09:18:16,205 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.ecr.get-authorization-token: calling handler <function add_streaming_output_arg at 0x103765440>
2024-06-13 09:18:16,205 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.ecr.get-authorization-token: calling handler <function add_cli_input_json at 0x102fd89a0>
2024-06-13 09:18:16,206 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.ecr.get-authorization-token: calling handler <function add_cli_input_yaml at 0x102fd8a40>
2024-06-13 09:18:16,206 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.ecr.get-authorization-token: calling handler <function unify_paging_params at 0x10357b4c0>
2024-06-13 09:18:16,211 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/data/ecr/2015-09-21/paginators-1.json
2024-06-13 09:18:16,211 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.ecr.get-authorization-token: calling handler <function add_generate_skeleton at 0x1036947c0>
2024-06-13 09:18:16,211 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.ecr.get-authorization-token: calling handler <bound method OverrideRequiredArgsArgument.override_required_args of <awscli.customizations.cliinput.CliInputJSONArgument object at 0x1039b39d0>>
2024-06-13 09:18:16,211 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.ecr.get-authorization-token: calling handler <bound method OverrideRequiredArgsArgument.override_required_args of <awscli.customizations.cliinput.CliInputYAMLArgument object at 0x1039b3f90>>
2024-06-13 09:18:16,211 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.ecr.get-authorization-token: calling handler <bound method GenerateCliSkeletonArgument.override_required_args of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x1039c2350>>
2024-06-13 09:18:16,211 - MainThread - botocore.hooks - DEBUG - Event building-command-table.ecr_get-authorization-token: calling handler <function add_waiters at 0x103767420>
2024-06-13 09:18:16,211 - MainThread - botocore.hooks - DEBUG - Event building-command-table.ecr_get-authorization-token: calling handler <bound method AliasSubCommandInjector.on_building_command_table of <awscli.alias.AliasSubCommandInjector object at 0x103842050>>
2024-06-13 09:18:16,211 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.api.ecr.get-authorization-token.registry-ids: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10187a410>
2024-06-13 09:18:16,211 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.api.ecr.get-authorization-token.cli-input-json: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10187a410>
2024-06-13 09:18:16,211 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.api.ecr.get-authorization-token.cli-input-yaml: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10187a410>
2024-06-13 09:18:16,211 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.api.ecr.get-authorization-token.generate-cli-skeleton: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10187a410>
2024-06-13 09:18:16,211 - MainThread - botocore.hooks - DEBUG - Event calling-command.ecr.get-authorization-token: calling handler <bound method CliInputArgument.add_to_call_parameters of <awscli.customizations.cliinput.CliInputJSONArgument object at 0x1039b39d0>>
2024-06-13 09:18:16,211 - MainThread - botocore.hooks - DEBUG - Event calling-command.ecr.get-authorization-token: calling handler <bound method CliInputArgument.add_to_call_parameters of <awscli.customizations.cliinput.CliInputYAMLArgument object at 0x1039b3f90>>
2024-06-13 09:18:16,211 - MainThread - botocore.hooks - DEBUG - Event calling-command.ecr.get-authorization-token: calling handler <bound method GenerateCliSkeletonArgument.generate_skeleton of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x1039c2350>>
2024-06-13 09:18:16,211 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: env
2024-06-13 09:18:16,211 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: assume-role
2024-06-13 09:18:16,211 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: assume-role-with-web-identity
2024-06-13 09:18:16,211 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: sso
2024-06-13 09:18:16,211 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: shared-credentials-file
2024-06-13 09:18:16,212 - MainThread - botocore.credentials - INFO - Found credentials in shared credentials file: ~/.aws/credentials
2024-06-13 09:18:16,212 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/data/endpoints.json
2024-06-13 09:18:16,217 - MainThread - botocore.hooks - DEBUG - Event choose-service-name: calling handler <function handle_service_name_alias at 0x102050400>
2024-06-13 09:18:16,223 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/data/ecr/2015-09-21/endpoint-rule-set-1.json
2024-06-13 09:18:16,223 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/data/partitions.json
2024-06-13 09:18:16,224 - MainThread - botocore.hooks - DEBUG - Event creating-client-class.ecr: calling handler <function add_generate_presigned_url at 0x101f877e0>
2024-06-13 09:18:16,224 - MainThread - botocore.configprovider - DEBUG - Looking for endpoint for ecr via: environment_service
2024-06-13 09:18:16,224 - MainThread - botocore.configprovider - DEBUG - Looking for endpoint for ecr via: environment_global
2024-06-13 09:18:16,224 - MainThread - botocore.configprovider - DEBUG - Looking for endpoint for ecr via: config_service
2024-06-13 09:18:16,224 - MainThread - botocore.configprovider - DEBUG - Looking for endpoint for ecr via: config_global
2024-06-13 09:18:16,224 - MainThread - botocore.configprovider - DEBUG - No configured endpoint found.
2024-06-13 09:18:16,225 - MainThread - botocore.endpoint - DEBUG - Setting api.ecr timeout as (60, 60)
2024-06-13 09:18:16,225 - MainThread - botocore.hooks - DEBUG - Event provide-client-params.ecr.GetAuthorizationToken: calling handler <function base64_decode_input_blobs at 0x103800fe0>
2024-06-13 09:18:16,225 - MainThread - botocore.hooks - DEBUG - Event before-parameter-build.ecr.GetAuthorizationToken: calling handler <function generate_idempotent_uuid at 0x102052840>
2024-06-13 09:18:16,225 - MainThread - botocore.regions - DEBUG - Calling endpoint provider with parameters: {'Region': 'eu-central-1', 'UseDualStack': False, 'UseFIPS': False}
2024-06-13 09:18:16,225 - MainThread - botocore.regions - DEBUG - Endpoint provider result: https://api.ecr.eu-central-1.amazonaws.com
2024-06-13 09:18:16,225 - MainThread - botocore.hooks - DEBUG - Event before-call.ecr.GetAuthorizationToken: calling handler <function inject_api_version_header_if_needed at 0x10207c360>
2024-06-13 09:18:16,225 - MainThread - botocore.endpoint - DEBUG - Making request for OperationModel(name=GetAuthorizationToken) with params: {'url_path': '/', 'query_string': '', 'method': 'POST', 'headers': {'X-Amz-Target': 'AmazonEC2ContainerRegistry_V20150921.GetAuthorizationToken', 'Content-Type': 'application/x-amz-json-1.1', 'User-Agent': 'aws-cli/2.16.7 md/awscrt#0.19.19 ua/2.0 os/macos#23.5.0 md/arch#arm64 lang/python#3.11.9 md/pyimpl#CPython cfg/retry-mode#standard md/installer#source md/prompt#off md/command#ecr.get-authorization-token'}, 'body': b'{}', 'url': 'https://api.ecr.eu-central-1.amazonaws.com/', 'context': {'client_region': 'eu-central-1', 'client_config': <botocore.config.Config object at 0x103edaf90>, 'has_streaming_input': False, 'auth_type': None}}
2024-06-13 09:18:16,225 - MainThread - botocore.hooks - DEBUG - Event request-created.ecr.GetAuthorizationToken: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x10308c090>>
2024-06-13 09:18:16,225 - MainThread - botocore.hooks - DEBUG - Event choose-signer.ecr.GetAuthorizationToken: calling handler <function set_operation_specific_signer at 0x102052700>
2024-06-13 09:18:16,225 - MainThread - botocore.auth - DEBUG - Calculating signature using v4 auth.
2024-06-13 09:18:16,225 - MainThread - botocore.auth - DEBUG - CanonicalRequest:
POST
/

content-type:application/x-amz-json-1.1
host:api.ecr.eu-central-1.amazonaws.com
x-amz-date:20240613T071816Z
x-amz-target:AmazonEC2ContainerRegistry_V20150921.GetAuthorizationToken

content-type;host;x-amz-date;x-amz-target
44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a
2024-06-13 09:18:16,225 - MainThread - botocore.auth - DEBUG - StringToSign:
AWS4-HMAC-SHA256
20240613T071816Z
20240613/eu-central-1/ecr/aws4_request
baa697e0e72ef40c36b08cdbd463988915897f461a5f26173c8f259468120bd6
2024-06-13 09:18:16,225 - MainThread - botocore.auth - DEBUG - Signature:
babc7f092aa30f5d90fc5583eecc605d9dfd2a2a07071988679f75a1f4b5613f
2024-06-13 09:18:16,225 - MainThread - botocore.endpoint - DEBUG - Sending http request: <AWSPreparedRequest stream_output=False, method=POST, url=https://api.ecr.eu-central-1.amazonaws.com/, headers={'X-Amz-Target': b'AmazonEC2ContainerRegistry_V20150921.GetAuthorizationToken', 'Content-Type': b'application/x-amz-json-1.1', 'User-Agent': b'aws-cli/2.16.7 md/awscrt#0.19.19 ua/2.0 os/macos#23.5.0 md/arch#arm64 lang/python#3.11.9 md/pyimpl#CPython cfg/retry-mode#standard md/installer#source md/prompt#off md/command#ecr.get-authorization-token', 'X-Amz-Date': b'20240613T071816Z', 'Authorization': b'AWS4-HMAC-SHA256 Credential=AKIAUUJ7UI23RE54XSPJ/20240613/eu-central-1/ecr/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=babc7f092aa30f5d90fc5583eecc605d9dfd2a2a07071988679f75a1f4b5613f', 'Content-Length': '2'}>
2024-06-13 09:18:16,226 - MainThread - botocore.httpsession - DEBUG - Certificate path: /opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/cacert.pem
2024-06-13 09:18:16,226 - MainThread - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.ecr.eu-central-1.amazonaws.com:443
2024-06-13 09:18:16,275 - MainThread - botocore.endpoint - DEBUG - Exception received when sending HTTP request.
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/util/connection.py", line 95, in create_connection
    raise err
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection
    sock.connect(sa)
OSError: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/httpsession.py", line 448, in send
    urllib_response = conn.urlopen(
                      ^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py", line 799, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/util/retry.py", line 525, in increment
    raise six.reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/packages/six.py", line 770, in reraise
    raise value
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py", line 715, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py", line 404, in _make_request
    self._validate_conn(conn)
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1058, in _validate_conn
    conn.connect()
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connection.py", line 363, in connect
    self.sock = conn = self._new_conn()
                       ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <botocore.awsrequest.AWSHTTPSConnection object at 0x10398cbd0>: Failed to establish a new connection: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/endpoint.py", line 199, in _do_get_response
    http_response = self._send(request)
                    ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/endpoint.py", line 271, in _send
    return self.http_session.send(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/httpsession.py", line 477, in send
    raise EndpointConnectionError(endpoint_url=request.url, error=e)
botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://api.ecr.eu-central-1.amazonaws.com/"
2024-06-13 09:18:16,280 - MainThread - botocore.hooks - DEBUG - Event needs-retry.ecr.GetAuthorizationToken: calling handler <bound method RetryHandler.needs_retry of <botocore.retries.standard.RetryHandler object at 0x103ee4b90>>
2024-06-13 09:18:16,280 - MainThread - botocore.retries.standard - DEBUG - Retry needed, retrying request after delay of: 0.22672018033645325
2024-06-13 09:18:16,280 - MainThread - botocore.endpoint - DEBUG - Response received to retry, sleeping for 0.22672018033645325 seconds
2024-06-13 09:18:16,512 - MainThread - botocore.hooks - DEBUG - Event request-created.ecr.GetAuthorizationToken: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x10308c090>>
2024-06-13 09:18:16,513 - MainThread - botocore.hooks - DEBUG - Event choose-signer.ecr.GetAuthorizationToken: calling handler <function set_operation_specific_signer at 0x102052700>
2024-06-13 09:18:16,513 - MainThread - botocore.auth - DEBUG - Calculating signature using v4 auth.
2024-06-13 09:18:16,513 - MainThread - botocore.auth - DEBUG - CanonicalRequest:
POST
/

content-type:application/x-amz-json-1.1
host:api.ecr.eu-central-1.amazonaws.com
x-amz-date:20240613T071816Z
x-amz-target:AmazonEC2ContainerRegistry_V20150921.GetAuthorizationToken

content-type;host;x-amz-date;x-amz-target
44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a
2024-06-13 09:18:16,513 - MainThread - botocore.auth - DEBUG - StringToSign:
AWS4-HMAC-SHA256
20240613T071816Z
20240613/eu-central-1/ecr/aws4_request
baa697e0e72ef40c36b08cdbd463988915897f461a5f26173c8f259468120bd6
2024-06-13 09:18:16,514 - MainThread - botocore.auth - DEBUG - Signature:
babc7f092aa30f5d90fc5583eecc605d9dfd2a2a07071988679f75a1f4b5613f
2024-06-13 09:18:16,514 - MainThread - botocore.endpoint - DEBUG - Sending http request: <AWSPreparedRequest stream_output=False, method=POST, url=https://api.ecr.eu-central-1.amazonaws.com/, headers={'X-Amz-Target': b'AmazonEC2ContainerRegistry_V20150921.GetAuthorizationToken', 'Content-Type': b'application/x-amz-json-1.1', 'User-Agent': b'aws-cli/2.16.7 md/awscrt#0.19.19 ua/2.0 os/macos#23.5.0 md/arch#arm64 lang/python#3.11.9 md/pyimpl#CPython cfg/retry-mode#standard md/installer#source md/prompt#off md/command#ecr.get-authorization-token', 'X-Amz-Date': b'20240613T071816Z', 'Authorization': b'AWS4-HMAC-SHA256 Credential=AKIAUUJ7UI23RE54XSPJ/20240613/eu-central-1/ecr/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=babc7f092aa30f5d90fc5583eecc605d9dfd2a2a07071988679f75a1f4b5613f', 'Content-Length': '2'}>
2024-06-13 09:18:16,514 - MainThread - botocore.httpsession - DEBUG - Certificate path: /opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/cacert.pem
2024-06-13 09:18:16,515 - MainThread - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (2): api.ecr.eu-central-1.amazonaws.com:443
2024-06-13 09:18:16,518 - MainThread - botocore.endpoint - DEBUG - Exception received when sending HTTP request.
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/util/connection.py", line 95, in create_connection
    raise err
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection
    sock.connect(sa)
OSError: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/httpsession.py", line 448, in send
    urllib_response = conn.urlopen(
                      ^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py", line 799, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/util/retry.py", line 525, in increment
    raise six.reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/packages/six.py", line 770, in reraise
    raise value
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py", line 715, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py", line 404, in _make_request
    self._validate_conn(conn)
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1058, in _validate_conn
    conn.connect()
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connection.py", line 363, in connect
    self.sock = conn = self._new_conn()
                       ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <botocore.awsrequest.AWSHTTPSConnection object at 0x103f366d0>: Failed to establish a new connection: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/endpoint.py", line 199, in _do_get_response
    http_response = self._send(request)
                    ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/endpoint.py", line 271, in _send
    return self.http_session.send(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/httpsession.py", line 477, in send
    raise EndpointConnectionError(endpoint_url=request.url, error=e)
botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://api.ecr.eu-central-1.amazonaws.com/"
2024-06-13 09:18:16,520 - MainThread - botocore.hooks - DEBUG - Event needs-retry.ecr.GetAuthorizationToken: calling handler <bound method RetryHandler.needs_retry of <botocore.retries.standard.RetryHandler object at 0x103ee4b90>>
2024-06-13 09:18:16,520 - MainThread - botocore.retries.standard - DEBUG - Retry needed, retrying request after delay of: 1.2145648303549876
2024-06-13 09:18:16,520 - MainThread - botocore.endpoint - DEBUG - Response received to retry, sleeping for 1.2145648303549876 seconds
2024-06-13 09:18:17,740 - MainThread - botocore.hooks - DEBUG - Event request-created.ecr.GetAuthorizationToken: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x10308c090>>
2024-06-13 09:18:17,740 - MainThread - botocore.hooks - DEBUG - Event choose-signer.ecr.GetAuthorizationToken: calling handler <function set_operation_specific_signer at 0x102052700>
2024-06-13 09:18:17,741 - MainThread - botocore.auth - DEBUG - Calculating signature using v4 auth.
2024-06-13 09:18:17,741 - MainThread - botocore.auth - DEBUG - CanonicalRequest:
POST
/

content-type:application/x-amz-json-1.1
host:api.ecr.eu-central-1.amazonaws.com
x-amz-date:20240613T071817Z
x-amz-target:AmazonEC2ContainerRegistry_V20150921.GetAuthorizationToken

content-type;host;x-amz-date;x-amz-target
44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a
2024-06-13 09:18:17,741 - MainThread - botocore.auth - DEBUG - StringToSign:
AWS4-HMAC-SHA256
20240613T071817Z
20240613/eu-central-1/ecr/aws4_request
1c361c442890fd524699c7df7939e485a566aa66c3c634b79903534ea2c0686d
2024-06-13 09:18:17,742 - MainThread - botocore.auth - DEBUG - Signature:
2413a5cb0dc5944734eaef3c3870114bcb7d487afe48d349fc96de56aeb15da9
2024-06-13 09:18:17,742 - MainThread - botocore.endpoint - DEBUG - Sending http request: <AWSPreparedRequest stream_output=False, method=POST, url=https://api.ecr.eu-central-1.amazonaws.com/, headers={'X-Amz-Target': b'AmazonEC2ContainerRegistry_V20150921.GetAuthorizationToken', 'Content-Type': b'application/x-amz-json-1.1', 'User-Agent': b'aws-cli/2.16.7 md/awscrt#0.19.19 ua/2.0 os/macos#23.5.0 md/arch#arm64 lang/python#3.11.9 md/pyimpl#CPython cfg/retry-mode#standard md/installer#source md/prompt#off md/command#ecr.get-authorization-token', 'X-Amz-Date': b'20240613T071817Z', 'Authorization': b'AWS4-HMAC-SHA256 Credential=AKIAUUJ7UI23RE54XSPJ/20240613/eu-central-1/ecr/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=2413a5cb0dc5944734eaef3c3870114bcb7d487afe48d349fc96de56aeb15da9', 'Content-Length': '2'}>
2024-06-13 09:18:17,742 - MainThread - botocore.httpsession - DEBUG - Certificate path: /opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/cacert.pem
2024-06-13 09:18:17,743 - MainThread - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (3): api.ecr.eu-central-1.amazonaws.com:443
2024-06-13 09:18:17,747 - MainThread - botocore.endpoint - DEBUG - Exception received when sending HTTP request.
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/util/connection.py", line 95, in create_connection
    raise err
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection
    sock.connect(sa)
OSError: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/httpsession.py", line 448, in send
    urllib_response = conn.urlopen(
                      ^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py", line 799, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/util/retry.py", line 525, in increment
    raise six.reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/packages/six.py", line 770, in reraise
    raise value
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py", line 715, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py", line 404, in _make_request
    self._validate_conn(conn)
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1058, in _validate_conn
    conn.connect()
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connection.py", line 363, in connect
    self.sock = conn = self._new_conn()
                       ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <botocore.awsrequest.AWSHTTPSConnection object at 0x103f37950>: Failed to establish a new connection: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/endpoint.py", line 199, in _do_get_response
    http_response = self._send(request)
                    ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/endpoint.py", line 271, in _send
    return self.http_session.send(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/httpsession.py", line 477, in send
    raise EndpointConnectionError(endpoint_url=request.url, error=e)
botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://api.ecr.eu-central-1.amazonaws.com/"
2024-06-13 09:18:17,749 - MainThread - botocore.hooks - DEBUG - Event needs-retry.ecr.GetAuthorizationToken: calling handler <bound method RetryHandler.needs_retry of <botocore.retries.standard.RetryHandler object at 0x103ee4b90>>
2024-06-13 09:18:17,750 - MainThread - botocore.retries.standard - DEBUG - Max attempts of 3 reached.
2024-06-13 09:18:17,750 - MainThread - botocore.retries.standard - DEBUG - Not retrying request.
2024-06-13 09:18:17,750 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/util/connection.py", line 95, in create_connection
    raise err
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/util/connection.py", line 85, in create_connection
    sock.connect(sa)
OSError: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/httpsession.py", line 448, in send
    urllib_response = conn.urlopen(
                      ^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py", line 799, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/util/retry.py", line 525, in increment
    raise six.reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/packages/six.py", line 770, in reraise
    raise value
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py", line 715, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py", line 404, in _make_request
    self._validate_conn(conn)
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1058, in _validate_conn
    conn.connect()
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connection.py", line 363, in connect
    self.sock = conn = self._new_conn()
                       ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <botocore.awsrequest.AWSHTTPSConnection object at 0x103f37950>: Failed to establish a new connection: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/clidriver.py", line 499, in main
    return command_table[parsed_args.command](remaining, parsed_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/clidriver.py", line 634, in __call__
    return command_table[parsed_args.operation](remaining, parsed_globals)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/clidriver.py", line 837, in __call__
    return self._operation_caller.invoke(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/clidriver.py", line 963, in invoke
    response = self._make_client_call(
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/clidriver.py", line 975, in _make_client_call
    response = getattr(client, xform_name(operation_name))(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/client.py", line 360, in _api_call
    return self._make_api_call(operation_name, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/client.py", line 725, in _make_api_call
    http, parsed_response = self._make_request(
                            ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/client.py", line 745, in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/endpoint.py", line 101, in make_request
    return self._send_request(request_dict, operation_model)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/endpoint.py", line 155, in _send_request
    raise exception
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/endpoint.py", line 199, in _do_get_response
    http_response = self._send(request)
                    ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/endpoint.py", line 271, in _send
    return self.http_session.send(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/awscli/2.16.7/libexec/lib/python3.11/site-packages/awscli/botocore/httpsession.py", line 477, in send
    raise EndpointConnectionError(endpoint_url=request.url, error=e)
botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://api.ecr.eu-central-1.amazonaws.com/"

Could not connect to the endpoint URL: "https://api.ecr.eu-central-1.amazonaws.com/"```

### Reproduction Steps

I installed awscli via brew. I also have conda installed, but I make sure to run `conda deactivate` beforehand, to prevent the wrong python version from being used. I compared sha1 hashes with a colleague regarding the following files, all being the same as his:

- /opt/homebrew/Cellar/awscli/2.16.6/libexec/lib/python3.11/site-packages/awscli/botocore/cacert.pem 
- /opt/homebrew/bin/aws

I reinstalled, uninstalled and installed aws multiple times now, to no avail.

I'm on macOS sonoma 14.5 on an Apple M3 Pro Macbook

```bash
~ >>>  brew info awscli                                                                                Thu Jun 13 09:20:04 2024
==> awscli: stable 2.16.7 (bottled), HEAD
Official Amazon AWS command-line interface
https://aws.amazon.com/cli/
Installed
/opt/homebrew/Cellar/awscli/2.16.7 (14,834 files, 135.1MB) *
  Poured from bottle using the formulae.brew.sh API on 2024-06-13 at 08:48:10
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/a/awscli.rb
License: Apache-2.0
==> Dependencies
Build: cmake ✔, pkg-config ✔, rust ✔
Required: openssl@3 ✔, python@3.11 ✔
==> Options
--HEAD
        Install HEAD version
==> Caveats
The "examples" directory has been installed to:
  /opt/homebrew/share/awscli/examples
==> Analytics
install: 171,939 (30 days), 446,618 (90 days), 1,601,880 (365 days)
install-on-request: 170,294 (30 days), 442,921 (90 days), 1,589,466 (365 days)
build-error: 4 (30 days)
~ >>>  aws --version                                                                          1561ms  Thu Jun 13 09:23:10 2024
aws-cli/2.16.7 Python/3.11.9 Darwin/23.5.0 source/arm64

Possible Solution

No response

Additional Information/Context

No response

CLI version used

2.16.7

Environment details (OS name and version, etc.)

macOS sonoma 14.5 on an Apple M3 Pro Macbook

tim-finnigan commented 2 weeks ago

Thanks for reaching out. Can you try installing by following the steps here: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html ? I just tested and was able to install the latest CLI version (2.16.8) on macOS.

The OSError: [Errno 9] Bad file descriptor error might be caused by an issue with your network or certificate. I would check that your environment doesn't have proxy/firewall configurations which may be causing this issue.

github-actions[bot] commented 1 week ago

Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.