aws-sam-cli: Unable to create Serverless API using SAM v1.40.0
Description:
I tried creating a SAM application using the quick start template for serverless API, but unfortunately it complains that it’s unable to local the quickstart-web template.
Steps to reproduce:
D:\Projects
λ sam init
You can preselect a particular runtime or package type when using the `sam init` experience.
Call `sam init --help` to learn more.
Which template source would you like to use?
1 - AWS Quick Start Templates
2 - Custom Template Location
Choice: 1
Choose an AWS Quick Start application template
1 - Hello World Example
2 - Multi-step workflow
3 - Serverless API
4 - Scheduled task
5 - Standalone function
6 - Data processing
7 - Infrastructure event management
8 - Machine Learning
Template: 3
Which runtime would you like to use?
1 - dotnetcore3.1
2 - nodejs14.x
3 - nodejs12.x
4 - python3.9
5 - python3.8
Runtime: 2
Based on your selections, the only Package type available is Zip.
We will proceed to selecting the Package type as Zip.
Based on your selections, the only dependency manager available is npm.
We will proceed copying the template using npm.
Project name [sam-app]: sammy
Cloning from https://github.com/aws/aws-sam-cli-app-templates (process may take a moment)
Error: Can't find application template quick-start-web - check valid values in interactive init.
Observed result:
Error: Can’t find application template quick-start-web - check valid values in interactive init.
Expected result:
I expected it to create Serverless API project with it’s default scaffolding.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: Windows 10 Pro
sam --version
: SAM CLI, version 1.40.0- AWS region: us-east-2
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 22 (7 by maintainers)
This was closed prematurely imo. Latest packaged build for Windows (AWS_SAM_CLI_64_PY3.msi 2022-05-04) still has this issue.
@kamsar Thank you so much! Cloning the repository manually in to the app data directory solved the problem. @jfuss Maybe that’s the problem.
SAM cli
has some issue cloning to app data directories and can be looked into.For those who stumble upon the same thing, you can do the following to solve it temporarily:
run
and open the run command dialog.%APPDATA%\AWS SAM
and clickOK
.aws-sam-cli-app-templates
cmd
in the current directory and then clone the sam cli templates repository manually.git clone https://github.com/aws/aws-sam-cli-app-templates.git
sam init
in your actual workspace directory.Meanwhile, please refer here for a workaround
I ran into this issue as well. In my case:
%APPDATA%\AWS SAM\aws-sam-cli-app-templates
--debug
flag gives the genericClone error
message with no further detailssam
as has write access to the%APPDATA%\AWS SAM
folderI was able to fix it by:
%APPDATA%\AWS SAM
aws-sam-cli-app-templates
foldergit clone https://github.com/aws/aws-sam-cli-app-templates.git
to re-populate itObviously this does not solve the clone error problem, but it does unblock usage of
sam init
.Related issue is been fixed and released in latest 1.53.0 version. Please give it a try and let us know if you still experience similar issues.
Trying to clone the repo manually as described above gives me this error:
Thankfully I’m making a python Lambda so it isn’t impacting me
EDIT: Spoke to soon - now running into #1891. Wonder if it’s related EDIT 2: Enabled git longpaths system wide and that fixed both issues on my end
I encounter the same scenario when choosing “Serverless API” on the second prompt. I followed the same steps and was resolved. But I think that is not an Ideal fix. I hope that maintainer cloud look what’s wrong with choosing Serverless API
Looks like it’s the same issue as #3946, which was caused by long path limitation in Windows. We have a fix #3950 merged but not released yet