AWS UnicodeDecodeError when creating application on ElasticBeanstalk
Trying to create a Python application on ElasticBeanstalk using the CLI, after I select my platform version I get the following error:
Select a platform version. 1) Python 3.4 2) Python 3) Python 2.7 4) Python 3.4 (Preconfigured - Docker) (default is 1): 1 ERROR: UnicodeDecodeError :: 'ascii' codec can't decode byte 0xe2 in position 891: ordinal not in range(128)
I found this: https://github.com/aws/aws-cli/issues/708 which makes me think maybe I pasted my AWS credentials with a newline attached. I'd like to re-enter the credentials but it seems they are cached somewhere (it asked me for them on the first install attempt but not any subsequence attempts). I do not see them in my environment vars and I have been deleting .elasticbeanstalk between attempts. Any ideas?
update: I deleted .aws/config so it allowed me to re-enter my credentials. Still get the same error when I try to run eb init
update2: gist of --debug output can be found here: https://gist.github.com/dshuhler/8d64849021c48bf1ba71
.gitignore had a hidden non-ascii character as I had copy pasted a Python specific
.gitignore from a popular Github repository.
Steps I took to figure out the root cause
So, I couldn't find any answer that helped me solve this problem for me. Looks like, different people are seeing this error for different reasons.
I'm going to share the steps I took to figure out the cause for my problem. Make sure to run your command using
$ eb init --debug
My output was something like this
2019-05-05 13:44:17,548 (INFO) eb : Traceback (most recent call last): File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/ebcli/core/ebrun.py", line 62, in run_app app.run() File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/cement/core/foundation.py", line 797, in run return_val = self.controller._dispatch() File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/cement/core/controller.py", line 472, in _dispatch return func() File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/cement/core/controller.py", line 478, in _dispatch return func() File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/ebcli/core/abstractcontroller.py", line 89, in default self.do_command() File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/ebcli/controllers/initialize.py", line 118, in do_command initializeops.setup(app_name, region_name, platform, dir_path=None, repository=repository, branch=branch) File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/ebcli/operations/initializeops.py", line 57, in setup setup_ignore_file() File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/ebcli/operations/initializeops.py", line 92, in setup_ignore_file source_control.set_up_ignore_file() File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/ebcli/objects/sourcecontrol.py", line 294, in set_up_ignore_file for line in f: File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 1287: ordinal not in range(128)
I jumped into the source code, specifically this bit
for line in f:
I found out this is the part which was throwing the error
with open('.gitignore', 'r') as f: for line in f: if line.strip() == git_ignore: return
Once I removed the
.gitignore it worked like charm(and added it later without copy-paste)
Troubleshooting issues with the EB CLI, create a new branch in git, it is not attached to an Elastic Beanstalk the EC2 instance that's running your application and examine it directly. The AWS::ElasticBeanstalk::Application resource is an AWS Elastic Beanstalk resource type that specifies an Elastic Beanstalk application. Syntax. To declare this entity in your AWS CloudFormation template, use the following syntax:
It could be that your Beanstalk runs the Python environment without
LC_ALL defined. Setting
LC_ALL=en_US.UTF-8 in my Beanstalk environment properties resolved this issue for me.
Some background on these locale environment variables is available at: Explain the effects of export LANG, LC_CTYPE, LC_ALL
eb deploy: 'ascii' codec can't decode, The first time I tried to do the deploy, it failed w/ a unicode error processing the So now, the app deploys fine. I'm deploying from and the instance are running python 3.6.7 and were created with python 3.6.5, but I I'm relatively new to Elastic Beanstalk but I'm pretty sure I've got everything configured� For more information, see Using the Elastic Beanstalk command line interface (EB CLI), Creating and deploying Java applications on Elastic Beanstalk, and The AWS Toolkit for Visual Studio. Sections Creating a source bundle from the command line
your aws credentials are at
Elastic Beanstalk won't launch, Elastic Beanstalk won't launch worker environment. I'm not sure were these came from - I did not create them or modify We tracked down to a bug in our version deployment script that doesn't handle Unicode version name well. You can also create a application version with ASCII name using EB CLI� Specify internal if you want to create an internal load balancer in your Amazon VPC so that your Elastic Beanstalk application cannot be accessed from outside your Amazon VPC. If you specify a value other than public or internal , Elastic Beanstalk will ignore the value.
create-application — AWS CLI 1.18.123 Command Reference, Set to true to delete a version's source bundle from Amazon S3 when Elastic Beanstalk deletes the application version. Shorthand Syntax: ServiceRole=string, � In this tutorial, you will deploy a sample ASP.NET Web Application to an AWS Elastic Beanstalk application container. The rest of this section presents instructions for creating, testing, deploying, and redeploying your ASP.NET web application to Elastic Beanstalk.
Creating Elastic Beanstalk environments with the AWS CLI, source bundle in Amazon Simple Storage Service (Amazon S3). $ aws elasticbeanstalk create-application-version --application-name my-app --version- label� Elastic Beanstalk is the fastest and simplest way to deploy your application on AWS. You simply use the AWS Management Console, a Git repository, or an integrated development environment (IDE) such as Eclipse or Visual Studio to upload your application, and Elastic Beanstalk automatically handles the deployment details of capacity provisioning, load balancing, auto-scaling, and application
You will need an AWS account and IAM permissions to create an EC2 instance, Key Pair, Security Group, IAM user, and an Elastic Beanstalk environment. This tutorial will deploy an AWS CloudFormation template that automatically provisions the sample website on an EC2 instance that will be the source web application for the migration.
- This was my problem as well. Thanks.
- This is fixed in current
- Cutting it out from the repo and repasting it once eb init was done worked
- This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review
- @4dgaurav the person asked where are the credentials, and my answer fits his question. not sure why you think differently.
- this might be a comment to OP's question, in case otherwise, if OP accepts your answer, I will delete my comment.
- unfortunately this did not solve the problem. I updated the OP
- @DanS. can you share the rest of your setup? run it with
--debugand share the output in a gist.