Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: sam init - CalledProcessError #7929

Open
odxkamimoto opened this issue Mar 11, 2025 · 2 comments
Open

Bug: sam init - CalledProcessError #7929

odxkamimoto opened this issue Mar 11, 2025 · 2 comments
Labels

Comments

@odxkamimoto
Copy link

Description:

sam init --location git+ssh://[email protected]/my_org/my_repo.git failed with the following error.

2025-03-11 15:59:50 git clone failed with error: Cloning into 'odx-eq-lambda-aws-sam-python'...
OpenSSL version mismatch. Built against 30000020, you have 30300010
fatal: Could not read from remote repository.

Steps to reproduce:

  1. Create github repository and template with following structure:
❯ tree
.
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── cookiecutter.json
├── hooks
│   └── post_gen_project
└── {{cookiecutter.project_name}}
    ├── Makefile
    ├── Pipfile
    ├── README.md
    ├── buildspec.yaml
    ├── events
    │   └── testevent.json
    ├── function
    │   ├── __init__.py
    │   └── requirements.txt
    ├── samconfig.toml
    ├── template.yaml
    └── tests
        ├── __init__.py
        ├── conftest.py
        └── unit
            ├── __init__.py
            └── test_hello_function.py
			
  1. Run the command 'sam init --location git+ssh://[email protected]/my_org/my_repo.git'

Observed result:

2025-03-11 15:45:20 git clone failed with error: Cloning into 'my_repo'...
OpenSSL version mismatch. Built against 30000020, you have 30300010
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Error: Command '['git', 'clone', 'ssh://[email protected]/my_org/my_repo.git']' returned non-zero exit status 128.
Traceback:
File "click/core.py", line 1078, in main
File "click/core.py", line 1688, in invoke
File "click/core.py", line 1434, in invoke
File "click/core.py", line 783, in invoke
File "samcli/cli/cli_config_file.py", line 347, in wrapper
File "samcli/commands/init/command.py", line 103, in wrapped
File "click/decorators.py", line 92, in new_func
File "click/core.py", line 783, in invoke
File "samcli/lib/telemetry/metric.py", line 185, in wrapped
File "samcli/lib/telemetry/metric.py", line 150, in wrapped
File "samcli/lib/utils/version_checker.py", line 43, in wrapped
File "samcli/cli/main.py", line 95, in wrapper
File "samcli/commands/init/command.py", line 266, in cli
File "samcli/commands/init/command.py", line 347, in do_cli
File "samcli/commands/init/init_generator.py", line 24, in do_generate
File "samcli/lib/init/init.py", line 112, in generate_project
File "cookiecutter/main.py", line 80, in cookiecutter
File "cookiecutter/repository.py", line 108, in determine_repo_dir
File "cookiecutter/vcs.py", line 105, in clone
File "subprocess.py", line 466, in check_output
File "subprocess.py", line 571, in run

An unexpected error was encountered while executing "sam init".
Search for an existing issue:

Expected result:

sam init completes successfully and the project directory is created.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: Ubuntu 22.04(wsl)
  2. sam --version: SAM CLI, version 1.134.0
  3. AWS region: ap-northeast-1
# Paste the output of `sam --info` here

{
"version": "1.134.0",
"system": {
"python": "3.11.10",
"os": "Linux-5.15.167.4-microsoft-standard-WSL2-x86_64-with-glibc2.35"
},
"additional_dependencies": {
"docker_engine": "27.5.1",
"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"
]
}

Add --debug flag to command you are running

Same as the above results.

We have also confirmed that we can successfully clone from GitHub with the following command.

git clone git+ssh://[email protected]/my_org/my_repo.git

Also, the project is successfully created from CodeCommit's repository with the same contents.

@odxkamimoto odxkamimoto added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Mar 11, 2025
@vicheey
Copy link
Contributor

vicheey commented Mar 28, 2025

Thank you for reaching out. This is likely because of the permission that SAM CLI uses to get the package. I'll take a look.

@vicheey vicheey added type/bug area/init sam init and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Mar 29, 2025
@vicheey
Copy link
Contributor

vicheey commented Mar 29, 2025

I was not able to reproduce the issue using my private repo. Please let me know if there is any

sam --version
SAM CLI, version 1.134.0

sam init --location git+ssh://[email protected]/vicheey/CookieCutterSamSampleProjects.git
  [1/1] project_name (aws_sam_ocr): 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants