SAM CLI on Windows / WSL2 and Ubuntu
See original GitHub issueIssue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Unable to run sam cli on Windows Subsystem for Linux 2
I was able to install and use AWS SAM for WSL2 with Ubuntu 20.04.4 LTS. Share. Share a link to this answer. Copy...
Read more >Installing the AWS SAM CLI - AWS Serverless Application Model
This section describes how to install the AWS SAM CLI on macOS, Windows, and Linux.
Read more >SAM CLI integration has trouble with WSL #2056 - GitHub
The issue is in windows-land, docker linux-izes your mount paths, and then they sort of work for mounting if they are a direct...
Read more >FAQ's about Windows Subsystem for Linux - WSL
Using Bash, you can run command-line Linux tools and apps. ... Sam can enable WSL (& WSL 2 to improve speed and performance),...
Read more >Lambda: using AWS SAM Local to test ... - marcesher.com
AWS SAM Local is a “CLI tool for local development and testing of ... to use it in Windows Subsystem for Linux (WSL)...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry, i thought i already submitted the whole story. Anyway here is what i have experienced
OS windows 10 entreprise WSL2 ubuntu 20 Docker desktop with WSL2 option
Followed the installation for Linux as described in the documentation https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-linux.html
SAM cli version /usr/local/bin/sam --version SAM CLI, version 1.46.0
Ran sam init hello world (option 1)
Tried 2 different runtimes 8 - nodejs14.x 9 - nodejs12.x
sam local invoke fails as well as subsequent sam build commands
Invoking app.lambdaHandler (nodejs12.x) Image was not found. Removing rapid images for repo public.ecr.aws/sam/emulation-nodejs12.x Building image… Skip pulling image and use local one: public.ecr.aws/sam/emulation-nodejs12.x:rapid-1.46.0-x86_64.
Mounting /mnt/c/WebDevelopment/repo/sam/sam-app/sam-app/.aws-sam/build/HelloWorldFunction as /var/task:ro,delegated inside runtime container START RequestId: a406a014-84c7-45b0-ba59-3eda6e001c14 Version: $LATEST {“statusCode”:200,“body”:“{"message":"hello world"}”}END RequestId: a406a014-84c7-45b0-ba59-3eda6e001c14 REPORT RequestId: a406a014-84c7-45b0-ba59-3eda6e001c14 Init Duration: 0.28 ms Duration: 188.03 ms Billed Duration: 189 ms Memory Size: 128 MB Max Memory Used: 128 MB Traceback (most recent call last): File “samcli/main.py”, line 12, in <module> File “click/core.py”, line 829, in call File “click/core.py”, line 782, in main File “click/core.py”, line 1259, in invoke File “click/core.py”, line 1259, in invoke File “click/core.py”, line 1066, in invoke File “click/core.py”, line 610, in invoke File “click/decorators.py”, line 73, in new_func File “click/core.py”, line 610, in invoke File “samcli/lib/telemetry/metric.py”, line 146, in wrapped File “samcli/lib/iac/cdk/utils.py”, line 27, in is_cdk_project File “samcli/lib/iac/cdk/utils.py”, line 73, in _relevant_cdk_files_are_present FileNotFoundError: [Errno 2] No such file or directory [11624] Failed to execute script main
Looking at the source code, the line that’s failing is calling
os.getcwd()
. Based on this SO post,getcwd
can fail if its inside a deleted directory, which maybe happens here if the directory is removed after the Function ends?