Python3.6から3.9へ移行しているのですが、pytestを実行したところ、下記のエラーがたくさん出ました。
botocore.exceptions.ClientError: An error occurred (IllegalLocationConstraintException) when calling the CreateBucket operation: The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.
ライブラリのバージョンによるものだと思うのですが、どのライブラリをどのバージョンに上げたらいいでしょうか…?
aws cliのバージョンは1.20.0です。
bash-4.2# aws --version aws-cli/1.20.0 Python/3.9.10 Linux/5.10.76-linuxkit botocore/1.21.0
依存関係は問題なさそうです。
bash-4.2# pip check No broken requirements found. bash-4.2#
パッケージのリスト
bash-4.2# pip list Package Version ------------------ --------- attrs 22.1.0 awscli 1.20.0 boto3 1.18.0 botocore 1.21.0 certifi 2022.6.15 cffi 1.15.1 charset-normalizer 2.1.0 colorama 0.4.3 coverage 6.4.2 cryptography 37.0.4 docker 5.0.3 docutils 0.15.2 execnet 1.9.0 idna 3.3 iniconfig 1.1.1 Jinja2 2.11.3 jmespath 0.10.0 MarkupSafe 1.1.1 mock 4.0.3 more-itertools 8.13.0 moto 2.0.0 packaging 21.3 pep8 1.7.1 pip 22.2.2 pluggy 1.0.0 py 1.11.0 pyasn1 0.4.8 pycparser 2.21 pycrypto 2.6.1 pyparsing 3.0.9 pytest 6.2.5 pytest-cache 1.0 pytest-cov 3.0.0 pytest-mock 3.8.2 pytest-pep8 1.0.6 pytest-pythonpath 0.7.4 python-dateutil 2.8.2 pytz 2022.1 PyYAML 5.4.1 requests 2.28.1 responses 0.21.0 rsa 4.7.2 s3transfer 0.5.2 setuptools 58.1.0 six 1.16.0 toml 0.10.2 tomli 2.0.1 urllib3 1.26.11 websocket-client 1.3.3 Werkzeug 2.1.2 xmltodict 0.13.0 zipp 3.8.1
エラーの詳細 (一部抜粋)
______________________________________ test_invalid_request _______________________________________ mocker = <pytest_mock.plugin.MockerFixture object at 0x7f76a9b08940> @mock_s3 def test_invalid_request(mocker): > setup_mock(mocker) tests/scenario_update/test_scenario_update.py:99: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/scenario_update/test_scenario_update.py:66: in setup_mock s3.create_bucket(Bucket=Config().s3_bucket()) /.pyenv/versions/3.9.10/lib/python3.9/site-packages/botocore/client.py:386: in _api_call return self._make_api_call(operation_name, kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <botocore.client.S3 object at 0x7f76aa252c10>, operation_name = 'CreateBucket' api_params = {'Bucket': 'amsui-devdev-ap-northeast-1-111122223333-main'} def _make_api_call(self, operation_name, api_params): operation_model = self._service_model.operation_model(operation_name) service_name = self._service_model.service_name history_recorder.record('API_CALL', { 'service': service_name, 'operation': operation_name, 'params': api_params, }) if operation_model.deprecated: logger.debug('Warning: %s.%s() is deprecated', service_name, operation_name) request_context = { 'client_region': self.meta.region_name, 'client_config': self.meta.config, 'has_streaming_input': operation_model.has_streaming_input, 'auth_type': operation_model.auth_type, } request_dict = self._convert_to_request_dict( api_params, operation_model, context=request_context) service_id = self._service_model.service_id.hyphenize() handler, event_response = self.meta.events.emit_until_response( 'before-call.{service_id}.{operation_name}'.format( service_id=service_id, operation_name=operation_name), model=operation_model, params=request_dict, request_signer=self._request_signer, context=request_context) if event_response is not None: http, parsed_response = event_response else: http, parsed_response = self._make_request( operation_model, request_dict, request_context) self.meta.events.emit( 'after-call.{service_id}.{operation_name}'.format( service_id=service_id, operation_name=operation_name), http_response=http, parsed=parsed_response, model=operation_model, context=request_context ) if http.status_code >= 300: error_code = parsed_response.get("Error", {}).get("Code") error_class = self.exceptions.from_code(error_code) > raise error_class(parsed_response, operation_name) E botocore.exceptions.ClientError: An error occurred (IllegalLocationConstraintException) when calling the CreateBucket operation: The unspecified location constraint is incompatible for the region specific endpoint this request was sent to. /.pyenv/versions/3.9.10/lib/python3.9/site-packages/botocore/client.py:705: ClientError
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/08/05 09:35