Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper upload_to_s3 error messaging #1316

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion zappa/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,11 @@ def upload_to_s3(self, source_path, bucket_name, disable_progress=False):
"""
try:
self.s3_client.head_bucket(Bucket=bucket_name)
except botocore.exceptions.ClientError:
except botocore.exceptions.ClientError as e:
# https://github.com/zappa/Zappa/issues/1315
# 403 means bucket exists but the user does not have access
if e.response['Error']['Code'] == '403':
raise Exception(f'AWS Error: {e}. On bucket: {bucket_name}. This is likely an AWS permission issue, try adding s3:ListBucket to the deploying user or role.')
# This is really stupid S3 quirk. Technically, us-east-1 one has no S3,
# it's actually "US Standard", or something.
# More here: https://github.com/boto/boto3/issues/125
Expand Down