Comments (10)
Thanks! I switched over to Rancher Desktop and can now reproduce the problem, we're making progress! It looks like this may have something to do with how both flavours deal with bind mounts.
SAM CLI passes the source directory as a folder that is on the Windows machine (eg. C:\my\cool\path
), and the destination as a path in the container (eg. /var/task
). We use a Docker API library to communicate with the daemon, and it looks like on both Docker and Rancher Desktop, the windows path is correctly converted to something POSIX like (eg. /c/my/cool/path
), but only Docker Desktop is able to handle this path and mount the folder. Rancher Desktop won't bind mount correctly.
This is a little weird, since the actual path on WSL is /mnt/c/...
. If I was do manually run docker run -v C:\my\cool\path:/var/path ...
on Rancher, it will work. I don't have a workaround right now, but we'll continue to look into it.
from aws-sam-cli.
Hi @doteric, Thanks for raising this issue. Could you provide some more details such as what options you selected when running the sam init command? I haven't been able to reproduce your exact error so this would help us with that
from aws-sam-cli.
Hey @sidhujus
Thank you for the reply. Here is end generation log:
-----------------------
Generating application:
-----------------------
Name: example
Runtime: nodejs20.x
Architectures: x86_64
Dependency Manager: npm
Application Template: hello-world-typescript
Output Directory: .
Configuration file: example\samconfig.toml
That's that suit you or you would like something more?
from aws-sam-cli.
Hi @doteric
Did you use the -t option to specify a file that is not template.yaml?
I also had the same problem error when I used the -t option.
from aws-sam-cli.
Hey @YamaguchiGen-TR ,
No, I have not provided the -t
(template file path) param when running any commands. It seems to detect the template file correctly without it and I assume you mean that you have provided it with the wrong path?
Thank you for the idea though 💪
from aws-sam-cli.
Hi @doteric
I think the template file is detected correctly. If the -t option is not specified, template.[yaml|yml] in the current directory is used.Thank you for your reply!
from aws-sam-cli.
Hi, I unfortunately can't reproduce this with the node20 Typescript provided template.
I ran:
sam build
sam local invoke
Here is the system I tried it on:
PS C:\Users\Administrator\Desktop\sam-app> sam --info
{
"version": "1.120.0",
"system": {
"python": "3.11.8",
"os": "Windows-10-10.0.20348-SP0"
},
"additional_dependencies": {
"docker_engine": "25.0.3",
"aws_cdk": "Not available",
"terraform": "Not available"
},
"available_beta_feature_env_vars": [
"SAM_CLI_BETA_FEATURES",
"SAM_CLI_BETA_BUILD_PERFORMANCE",
"SAM_CLI_BETA_TERRAFORM_SUPPORT",
"SAM_CLI_BETA_RUST_CARGO_LAMBDA"
]
}
Docker version:
PS C:\Users\Administrator\Desktop\sam-app> docker version
Client:
Cloud integration: v1.0.35+desktop.11
Version: 25.0.3
API version: 1.44
Go version: go1.21.6
Git commit: 4debf41
Built: Tue Feb 6 21:13:02 2024
OS/Arch: windows/amd64
Context: default
Server: Docker Desktop 4.28.0 (139021)
Engine:
Version: 25.0.3
API version: 1.44 (minimum version 1.24)
Go version: go1.21.6
Git commit: f417435
Built: Tue Feb 6 21:14:25 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.28
GitCommit: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
runc:
Version: 1.1.12
GitCommit: v1.1.12-0-g51d5e94
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Can you copy and paste the contents of the sam --info
and docker version
command here? Thanks
from aws-sam-cli.
Hello @lucashuy
Really appreciate the contribution 🙇
Here are the results of the mentioned:
sam --info
{
"version": "1.120.0",
"system": {
"python": "3.11.8",
"os": "Windows-10-10.0.22631-SP0"
},
"additional_dependencies": {
"docker_engine": "25.0.5",
"aws_cdk": "Not available",
"terraform": "Not available"
},
"available_beta_feature_env_vars": [
"SAM_CLI_BETA_FEATURES",
"SAM_CLI_BETA_BUILD_PERFORMANCE",
"SAM_CLI_BETA_TERRAFORM_SUPPORT",
"SAM_CLI_BETA_RUST_CARGO_LAMBDA"
]
}
docker version
Client:
Version: 26.1.0-rd
API version: 1.44 (downgraded from 1.45)
Go version: go1.21.9
Git commit: cca8e72
Built: Tue Apr 23 16:26:59 2024
OS/Arch: windows/amd64
Context: default
Server:
Engine:
Version: 25.0.5
API version: 1.44 (minimum version 1.24)
Go version: go1.21.10
Git commit: e63daec8672d77ac0b2b5c262ef525c7cf17fd20
Built: Sun May 12 07:25:43 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.7.10
GitCommit: 4e1fe7492b9df85914c389d1f15a3ceedbb280ac
runc:
Version: 1.1.12
GitCommit: 51d5e94601ceffbbd85688df1c928ecccbfa4685
docker-init:
Version: 0.19.0
GitCommit:
Just a side node - I use Rancher Desktop for docker.
from aws-sam-cli.
Hello @lucashuy
Big thanks for picking this up, apart from using something other than Rancher Desktop is there some decent workaround that can be applied right now? Or any ETA on some fix? I'm wondering if I should change to something other than Rancher Desktop (for example Docker Desktop) or just wait for some fix.
Really appreciate your work btw, thank you 💪
from aws-sam-cli.
Sorry @doteric for the late reply, I don't have any particularly elegant workaround right now, but the workaround I do have involves using SAM CLI inside of WSL2, instead of on Windows.
- Install SAM CLI inside of WSL2 using our Linux artifacts
- Configure Rancher Desktop to expose itself inside of WSL2 (https://docs.rancherdesktop.io/ui/preferences/wsl/integrations)
- Rancher Desktop > Preferences > WSL > Integrations
- Inside of WSL2, remove the
credsStore
key and value from the~/.docker/config.json
file- I had done this since I don't have any credentials storage providers configured, this prevents the Docker daemon from erroring out
- Navigate to the project location from within WSL2
- In my case, I needed to
cd
into/mnt/c/users/administrator/desktop/sam-app
- In my case, I needed to
- Run your regular SAM CLI commands inside of WSL2
This can be a potential workaround for now while our team prioritizes a fix/the best way forward.
from aws-sam-cli.
Related Issues (20)
- Feature request: support Finch HOT 2
- Bug: sam local invoke - SSLError HOT 2
- start-api debug port failure HOT 1
- start-api debug port fails HOT 5
- Bug: `sam local invoke` takes client environment variable value over defined value in template.yaml HOT 3
- Sam build with project references in adjacent directory (.NET8 NativeAOT) HOT 4
- `sam sync` with typescript not updating Lambda layer code in Lambda function HOT 5
- Bug: Docker 4.33 + Provided.al2 Image error HOT 9
- Bug: SAM Deployment Issue: Bootstrap File Not Found Despite Successful Build and Upload HOT 1
- Bug: sam pipeline init - ResourceNotFoundException HOT 1
- Bug: Official example for CDK is not working HOT 1
- Bug: Runtime.ImportModuleError for Typescript Lambda function defined using CDK HOT 2
- Feature request: Run Node tests as part of sam build HOT 1
- Bug: sam build --container-env-var is not working HOT 1
- Thumbprint of the AWS SAM Windows MSI installer does not match the documentation HOT 1
- Bug: ResourceDetailedStatus never returns as part of a cloudformation event HOT 2
- Bug: sam build -u stuck on mounting HOT 9
- Bug: sam local invoke HelloWorld lambda times out on Apple M1 Pro after Sonoma upgrade HOT 2
- Bug: sam validate fails for template using 1.122.0 or 1.223.0 HOT 2
- Feature request: Prune Old Versions HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-sam-cli.