question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Don't raise an exception on failure to CreateBucket

See original GitHub issue
Traceback (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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
menshikh-ivcommented, Dec 6, 2017

@piskvorky work on it, will release smart_open today

1reaction
piskvorkycommented, Dec 2, 2017

Creating buckets by default would definitely be a bug, that’d be horrible, I agree.

@menshikh-iv what happened in 1.5.4?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found