NOTE. If you are reading this document then most probably you have missed some steps/notes from the AWS HOWTO/README. So this document itself just lists some most common types of errors and repeats the same instructions one more time.
-
NoCredentialsError: Unable to locate credentials.
-
botocore.exceptions.ProfileNotFound: The config profile (serverless) could not be found.
To fix the problem, follow the instructions from the
Custom AWS IAM Users and Policies for Deployment
section and configure your local AWS credentials
and config
files to have
the corresponding sections for your serverless
user.
botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the CreateBucket operation: Access Denied.
To fix the problem, follow the instructions from the
Custom AWS IAM Users and Policies for Deployment
section and attach the corrected Deployment Policy
to your serverless
user.
-
botocore.exceptions.ClientError: An error occurred (IllegalLocationConstraintException) when calling the CreateBucket operation: The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.
-
botocore.errorfactory.InvalidParameterValueException: An error occurred (InvalidParameterValueException) when calling the CreateFuncion operation: Error occurred while GetObject. S3 Error Code: PermanentRedirect. S3 Error Message: The bucket is in this region: <AWS_REGION>. Please use this region to retry the request.
-
botocore.errorfactory.BucketAlreadyExists: An error occurred (BucketAlreadyExists) when calling the CreateBucket operation: The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again.
Remember that S3 bucket names are globally unique even if they are physically
located in different regions. To fix the problem, modify the value of the
s3_bucket
setting in the Zappa Settings to be a
globally unique bucket name (e.g. by adding some random suffix to the end).
Example:
-
Before:
"s3_bucket": "tr-template-relay"
-
After:
"s3_bucket": "tr-template-relay-auk8ah9o15"
NOTE. Here is a simple code snippet in Python that might be helpful for generating random alphanumeric 10-character suffixes:
import random
import string
alphabet = string.ascii_lowercase + string.digits
length = 10
suffix = ''.join(random.choice(alphabet) for _ in range(length))
print(suffix)
botocore.errorfactory.NoSuchEntityException: An error occurred (NoSuchEntity) when calling the GetRole operation: The role with name tr-serverless-relay-ZappaLambdaExecutionRole cannot be found.
To fix the problem, follow the instructions from the
Custom AWS IAM Roles and Policies for Execution
section and create a role (based on the Execution Policy)
with the name corresponding to the value of the role_name
setting in the
Zappa Settings.
Error: Warning! Status check on the deployed lambda failed. A GET request to '/' yielded a 502 response code.
To fix the problem, install the application's requirements and update
the
Lambda:
pip install --upgrade --requirement requirements.txt && zappa update dev
If that does not help then try to undeploy
the Lambda altogether and deploy
it from scratch again:
zappa undeploy dev && zappa deploy dev