Giter VIP home page Giter VIP logo

Comments (10)

lucashuy avatar lucashuy commented on August 28, 2024 1

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.

sidhujus avatar sidhujus commented on August 28, 2024

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.

doteric avatar doteric commented on August 28, 2024

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.

YamaguchiGen-TR avatar YamaguchiGen-TR commented on August 28, 2024

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.

doteric avatar doteric commented on August 28, 2024

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.

YamaguchiGen-TR avatar YamaguchiGen-TR commented on August 28, 2024

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.

lucashuy avatar lucashuy commented on August 28, 2024

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.

doteric avatar doteric commented on August 28, 2024

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.

doteric avatar doteric commented on August 28, 2024

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.

lucashuy avatar lucashuy commented on August 28, 2024

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.

  1. Install SAM CLI inside of WSL2 using our Linux artifacts
  2. Configure Rancher Desktop to expose itself inside of WSL2 (https://docs.rancherdesktop.io/ui/preferences/wsl/integrations)
    • Rancher Desktop > Preferences > WSL > Integrations
  3. 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
  4. Navigate to the project location from within WSL2
    • In my case, I needed to cd into /mnt/c/users/administrator/desktop/sam-app
  5. 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.