Error while deploying SAM application using WSL2
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 807
- Avg merge
- 10h 12m
- Merged PRs (30d)
- 7
Description
While deploying a SAM application I get an error regarding the locale setting, even though this setting is set everywhere correctly.
```
Starting SAM Application deployment...
Building SAM Application...
Packaging SAM Application to S3 Bucket: mattg2019test
Error with child process: Traceback (most recent call last):
File "/home/matt/.local/bin/sam", line 8, in
sys.exit(cli())
File "/home/matt/.local/lib/python3.6/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/matt/.local/lib/python3.6/site-packages/click/core.py", line 760, in main
_verify_python3_env()
File "/home/matt/.local/lib/python3.6/site-packages/click/_unicodefun.py", line 130, in _verify_python3_env
" mitigation steps.{}".format(extra)
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult https://click.palletsprojects.com/python3/ for mitigation steps.
This system supports the C.UTF-8 locale which is recommended. You might be able to resolve your issue by exporting the following environment variables:
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
An error occurred while deploying a SAM Application. Check the logs for more information by running the "View AWS Toolkit Logs" command from the Command Palette.
```
Manual deployment within my WSL2 shell works as expected. It appears my shell variables are not being picked up by the extension. In VS Code developer tools, process.env just shows Windows environment variables and not Linux ones so the required locale is not listed.
AWS Toolkit logs are not providing further clarity:
```
2020-09-21 16:31:30 [INFO]: Running command: /home/matt/.local/bin/sam --info
2020-09-21 16:32:09 [INFO]: Starting SAM Application deployment...
2020-09-21 16:32:09 [INFO]: Building SAM Application...
2020-09-21 16:32:09 [INFO]: Running command: /home/matt/.local/bin/sam build --build-dir /tmp/aws-toolkit-vscode/samDeployWNsLsc/build --template /path/to/template.yaml
2020-09-21 16:32:12 [INFO]: Packaging SAM Application to S3 Bucket: mattg2019test
2020-09-21 16:32:12 [INFO]: Running command: /home/matt/.local/bin/sam package --template-file /tmp/aws-toolkit-vscode/samDeployWNsLsc/build/template.yaml --s3-bucket xxx --output-template-file /tmp/aws-toolkit-vscode/samDeployWNsLsc/template.yaml --region ap-southeast-2
2020-09-21 16:32:13 [ERROR]: Unexpected exitcode (1), expecting (0)
2020-09-21 16:32:13 [ERROR]: Error: undefined
2020-09-21 16:32:13 [ERROR]: stderr: Traceback (most recent call last):
File "/home/matt/.local/bin/sam", line 8, in
sys.exit(cli())
File "/home/matt/.local/lib/python3.6/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/matt/.local/lib/python3.6/site-packages/click/core.py", line 760, in main
_verify_python3_env()
File "/home/matt/.local/lib/python3.6/site-packages/click/_unicodefun.py", line 130, in _verify_python3_env
" mitigation steps.{}".format(extra)
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult https://click.palletsprojects.com/python3/ for mitigation steps.
This system supports the C.UTF-8 locale which is recommended. You might be able to resolve your issue by exporting the following environment variables:
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
2020-09-21 16:32:13 [ERROR]: stdout:
2020-09-21 16:32:13 [ERROR]: Error: Error with child process: Traceback (most recent call last):
File "/home/matt/.local/bin/sam", line 8, in
sys.exit(cli())
File "/home/matt/.local/lib/python3.6/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/matt/.local/lib/python3.6/site-packages/click/core.py", line 760, in main
_verify_python3_env()
File "/home/matt/.local/lib/python3.6/site-packages/click/_unicodefun.py", line 130, in _verify_python3_env
" mitigation steps.{}".format(extra)
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult https://click.palletsprojects.com/python3/ for mitigation steps.
This system supports the C.UTF-8 locale which is recommended. You might be able to resolve your issue by exporting the following environment variables:
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
at Object.t.logAndThrowIfUnexpectedExitCode (/home/matt/.vscode-server/extensions/amazonwebservices.aws-toolkit-vscode-1.13.0/dist/extension.js:2:509696)
at Object. (/home/matt/.vscode-server/extensions/amazonwebservices.aws-toolkit-vscode-1.13.0/dist/extension.js:2:6981372)
at Generator.next ()
at o (/home/matt/.vscode-server/extensions/amazonwebservices.aws-toolkit-vscode-1.13.0/dist/extension.js:2:6980797)
at processTicksAndRejections (internal/process/task_queues.js:94:5)
2020-09-21 16:32:13 [ERROR]: An error occurred while deploying a SAM Application. Check the logs for more information by running the "View AWS Toolkit Logs" command from the Command Palette.
2020-09-21 16:36:16 [INFO]: Successfully sent a telemetry batch of 11
```
**To Reproduce**
**Expected behavior**
I expect deployment to succeed as per running the SAM CLI in a WSL2 terminal window.
**Screenshots**
N/A
**Desktop (please complete the following information):**
OS: Linux x64 4.19.128-microsoft-standard
Visual Studio Code Version: 1.49.1
AWS Toolkit Version: 1.13.0
Ubuntu 18.04
WSL2
sam --version
SAM CLI, version 1.2.0
**Additional context**
N/A
Contributor guide
Research direction
Start with the “AWS: Deploy SAM Application” command and the SAM deployment steps shown in the AWS Toolkit logs, then inspect the referenced extension.js process-handling path. Compare the extension invocation with the working WSL2 terminal invocation; done means deployment succeeds in the reported WSL2/Ubuntu setup without the locale error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, linux, python, typescript, vscode
- Domain
- cloud, developer-experience, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100