Closed nabinkhadka closed 6 months ago
While working at feedback on this, I wanted to be sure if the creds can read and write a bucket. So I now need to add another try-except for achieving that which would have been good if failsafe
helped.
you can check this with write=True, read=True
.
I’ve identified other cases where it raises instead of returning False that are similar but different to the one you reported. Will fix and inform you. If your credentials are Ok, it won’t fail though.
@rgaudin Throws exception with write=True and read=True
>>> s3_storage.check_credentials(write=True, read=True, failsafe=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/nabin/upwork/kiwix/v3.8/lib/python3.8/site-packages/kiwixstorage/__init__.py", line 334, in check_credentials
self.test_access_write(
File "/Users/nabin/upwork/kiwix/v3.8/lib/python3.8/site-packages/kiwixstorage/__init__.py", line 286, in test_access_write
self.put_text_object(key, key, bucket_name=bucket_name)
File "/Users/nabin/upwork/kiwix/v3.8/lib/python3.8/site-packages/kiwixstorage/__init__.py", line 453, in put_text_object
self.client.put_object(
File "/Users/nabin/upwork/kiwix/v3.8/lib/python3.8/site-packages/botocore/client.py", line 316, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/Users/nabin/upwork/kiwix/v3.8/lib/python3.8/site-packages/botocore/client.py", line 626, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidAccessKeyId) when calling the PutObject operation: The AWS Access Key Id you provided does not exist in our records.
>>> s3_storage.check_credentials(write=True, failsafe=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/nabin/upwork/kiwix/v3.8/lib/python3.8/site-packages/kiwixstorage/__init__.py", line 334, in check_credentials
self.test_access_write(
File "/Users/nabin/upwork/kiwix/v3.8/lib/python3.8/site-packages/kiwixstorage/__init__.py", line 286, in test_access_write
self.put_text_object(key, key, bucket_name=bucket_name)
File "/Users/nabin/upwork/kiwix/v3.8/lib/python3.8/site-packages/kiwixstorage/__init__.py", line 453, in put_text_object
self.client.put_object(
File "/Users/nabin/upwork/kiwix/v3.8/lib/python3.8/site-packages/botocore/client.py", line 316, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/Users/nabin/upwork/kiwix/v3.8/lib/python3.8/site-packages/botocore/client.py", line 626, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidAccessKeyId) when calling the PutObject operation: The AWS Access Key Id you provided does not exist in our records.
That's exactly what I said. there are uncaught cases at the moment. But, it means your credentials are not OK.
I just pushed a script that simplifies testing. You can use it like:
PYTHONPATH=$(pwd)/src/ python src/kiwixstorage/test_credentials.py "https://xxxxx"
I see in your URL above that you use the eu-central-1
region in your URL. If the bucket you created is on another region (you had to choose where to create it and you can see it in your buckets list), then it won't work. That may be your problem.
This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.
For case with incorrect creds in the URL, I can see the following
In this case, the failsafe command works as expected.
Now , if I check for access to the bucket in URL,
The
failsafe
parameter does not work as expected. Similar behavior can be seen for other checks as well.