File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
lithops/storage/backends/aws_s3 Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,14 @@ def create_bucket(self, bucket_name):
8787 logger .debug (f"Could not find the bucket { bucket_name } in the AWS S3 storage backend" )
8888 logger .debug (f"Creating new bucket { bucket_name } in the AWS S3 storage backend" )
8989 bucket_config = {'LocationConstraint' : self .region }
90- self .s3_client .create_bucket (Bucket = bucket_name , CreateBucketConfiguration = bucket_config )
90+ try :
91+ self .s3_client .create_bucket (Bucket = bucket_name , CreateBucketConfiguration = bucket_config )
92+ except botocore .exceptions .ClientError as ce :
93+ error_code = ce .response .get ('Error' , {}).get ('Code' , 'Unknown' )
94+ if error_code == "InvalidLocationConstraint" and self .region == "us-east-1" :
95+ self .s3_client .create_bucket (Bucket = bucket_name )
96+ else :
97+ raise ce
9198 else :
9299 raise e
93100
You can’t perform that action at this time.
0 commit comments