Don't raise an exception on failure to CreateBucket
See original GitHub issueTraceback (most recent call last):
File "/opt/crash_uploader", line 165, in <module>
upload_user_coredump(pid, executable)
File "/opt/crash_uploader", line 123, in upload_user_coredump
with smart_open(dumpfile, 'wb') as s3out:
File "/usr/local/lib/python2.7/dist-packages/smart_open/smart_open_lib.py", line 175, in smart_open
return s3_open_uri(parsed_uri, mode, **kw)
File "/usr/local/lib/python2.7/dist-packages/smart_open/smart_open_lib.py", line 255, in s3_open_uri
fobj = smart_open_s3.open(parsed_uri.bucket_id, parsed_uri.key_id, s3_mode, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/smart_open/s3.py", line 60, in open
fileobj = BufferedOutputBase(bucket_id, key_id, min_part_size=s3_min_part_size, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/smart_open/s3.py", line 255, in __init__
s3.create_bucket(Bucket=bucket)
File "/usr/local/lib/python2.7/dist-packages/boto3/resources/factory.py", line 520, in do_action
response = action(self, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/boto3/resources/action.py", line 83, in __call__
response = getattr(parent.meta.client, operation_name)(**params)
File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 314, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 612, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the CreateBucket operation: Access Denied
In general implicit bucket creation seems like a bad call, in case of a misconfig. But if it is going to happen, it definitely shouldn’t block writing to that bucket if it already exists. (In our case this is running from an IAM box that does not have permission to create buckets, but can write to an existing bucket.)
Testing indicates this broke in 1.5.4
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
aws s3api create-bucket —bucket make exception
It gives this error: An error occurred (IllegalLocationConstraintException) when calling the CreateBucket operation: The unspecified location ...
Read more >Create an Amazon S3 bucket using an AWS SDK
... region) except ClientError as error: logger.exception( "Couldn't create bucket named '%s' in region=%s.", self.bucket.name, region) raise error.
Read more >Create Bucket failed - need some guidance - Python SDK
try: self.bm.drop_bucket(bucket); except BucketDoesNotExistException: pass; except Exception as e: raise; # now be sure it is really gone ...
Read more >Handling Errors in Boto3 & Botocore - Trek10
exceptions.ClientError: An error occurred (IllegalLocationConstraintException) when calling the CreateBucket operation: The unspecified location constraint is ...
Read more >IllegalLocationConstraintException error when using s3 ...
exceptions.ClientError: An error occurred (IllegalLocationConstraintException) when calling the CreateBucket operation: The unspecified location constraint is ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@piskvorky work on it, will release smart_open today
Creating buckets by default would definitely be a bug, that’d be horrible, I agree.
@menshikh-iv what happened in 1.5.4?