S3 Deploy Connection Error
This article provides resolution steps for popular errors encountered when deploying applications on Nex!™ from S3.
1 - Connection error to S3
When deploying an application from S3 you may see the following error:
('Connection aborted.', gaierror(-2, 'Name or service not known')
This means the AWS CLI is unable to locate the AWS region of your repository and is therefore not building the S3 url properly.
2 - Resolution for private buckets
It is very likely that the S3 credentials you used to link the application SCM are incorrect. AWS uses these credentials to lookup your bucket and automatically detect the bucket location. With invalid credentials the AWS CLI is unable to locate the region.
You can force the real error to appear by doing:
# Applicable if the S3 bucket is located in the ap-southeast-1 region nex-cli apps:vars my_app -a S3_REGION=ap-southeast-1 nex-cli apps:up
The following error should appear in the cubes:events
command
A client error (Forbidden) occurred when calling the HeadObject operation: Forbidden
To solve this issue simply relink your container to S3 using the right credentials
# Relink your app nex-cli apps:scm myapp --link s3:my-bucket/my_folder:my_branch --credentials MY_AWS_KEY:MY_AWS_SECRET # For help nex-cli apps:scm myapp -h
3 - Resolution for public buckets
With public buckets you do not need to provide credentials. However because credentials are not provided AWS is not always able to locate the AWS region your bucket is in.
Therefore it is preferable to specify the actual AWS region of your S3 bucket through your app environment variables.
# E.g. if your bucket is located in the ap-southeast-2 region nex-cli apps:vars my_app -a S3_REGION=ap-southeast-2