Won't upload to existing bucket on deploy
sasha42 opened this issue · comments
When deploying to an existing bucket, it errors out:
$ flask-zappa deploy production settings.json
Deploying production
Packaging project as zip....
An error occurred (BucketAlreadyOwnedByYou) when calling the CreateBucket operation: Your previous request to create the named bucket succeeded and you already own it.
Couldn't create bucket.
Traceback (most recent call last):
File "/Users/sasha/project/venv/bin/flask-zappa", line 263, in <module>
cli()
File "/Users/sasha/project/venv/lib/python2.7/site-packages/click/core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "/Users/sasha/project/venv/lib/python2.7/site-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/Users/sasha/project/venv/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/sasha/project/venv/lib/python2.7/site-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/sasha/project/venv/lib/python2.7/site-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/Users/sasha/project/venv/bin/flask-zappa", line 149, in deploy
memory_size=settings['memory_size'])
File "/Users/sasha/project/venv/lib/python2.7/site-packages/zappa/zappa.py", line 397, in create_lambda_function
VpcConfig=vpc_config
File "/Users/sasha/project/venv/lib/python2.7/site-packages/botocore/client.py", line 301, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/Users/sasha/project/venv/lib/python2.7/site-packages/botocore/client.py", line 398, in _make_api_call
raise ClientError(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidParameterValueException) when calling the CreateFunction operation: Error occurred while GetObject. S3 Error Code: NoSuchKey. S3 Error Message: The specified key does not exist.
However when deploying to a new one that didn't exist before, it works:
$ flask-zappa deploy production settings.json
Deploying production
Packaging project as zip....
Uploading zip (9.8MiB)...
Creating API Gateway routes..
480it [01:05, 7.61it/s] Deploying API Gateway..
Your Zappa deployment is live!: https://xxxx.execute-api.us-east-1.amazonaws.com/production
It worked for me when the Bucket and zappa configuration point to the same region.
"BucketAlreadyOwnedByYou" error still exists unless the bucket is in the same region as zappa configuration points to.