Open giedri opened 2 years ago
Thanks for raising this issue @giedri, apologies for late reply, it seems that URL is expired. If it is handy, can you re-generate one so that we can test with sam init
?
As per discussion offline, this URL can't be resolved as ZIP and cookiecutter
library assumes it as git repository and fails there. The library checks if the end of the URL is .zip
or not to decide that.
As a workaround for now, users can first download the link via wget
or another tool and then run the sam init
. I will also mark this as feature request for SAM CLI where this URL can be downloaded locally and then passed to the cookiecutter
as local file.
Description:
sam init --location "CloudFront signed URL here" fails with message "Error: The template location specified is not valid:..."
Steps to reproduce:
sam init --name "serverless-workshop" --location "https://static.us-east-1.prod.workshops.aws/8b7894f9-1c6c-4cb5-900a-a876378e79f3/static/serverless-workshop.zip?Policy=eyJTdGF0ZW1lbnQiOlt7...............2MjczNTcwMn19fV19&Key-Pair-Id=K36Q....7QD&Signature=JlDsUTg....U601jtB1F4WVHdgRRgST72UpZNr5A__"
Observed result:
Error: The template location specified is not valid: https://static.us-east-1.prod.workshops.aws/8b7894f9-1c6c-4cb5-900a-a876378e79f3/static/serverless-workshop.zip?Policy=eyJTdGF.......TcwMn19fV19&Key-Pair-Id=K36Q....7QD&Signature=JlDsUT....5iPhutGU601jtB1F4WVHdgRRgST72UpZNr5A__
Expected result:
Expect to get template zip file and use it as an initial structure. wget is able to get referred file just fine: wget "https://static.us-east-1.prod.workshops.aws/8b7894f9-1c6c-4cb5-900a-a876378e79f3/static/serverless-workshop.zip?Policy=eyJTdGF0ZW1l................................BB1F4WVHdgRRgST72UpZNr5A__"
The destination name is too long (641), reducing to 236 --2022-09-02 08:02:48-- https://static.us-east-1.prod.workshops.aws/8b7894f9-1c6c-4cb5-900a-a876378e79f3/static/serverless-workshop.zip?Policy=eyJTdG....Mn19fV19&Key-Pair-Id=K36Q....QD&Signature=JlDsUT....VHdgRRgST72UpZNr5A__ Resolving static.us-east-1.prod.workshops.aws (static.us-east-1.prod.workshops.aws)... ... Connecting to static.us-east-1.prod.workshops.aws (static.us-east-1.prod.workshops.aws)|....|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 6911 (6.7K) [application/zip] Saving to: ‘serverless-workshop.zip?Policy=eyJTd....ltZ’
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: SAM CLI, version 1.55.0Add --debug flag to command you are running
Debug output (sanitized): sam init --debug --name "serverless-workshop" --location "https://static.us-east-1.prod.workshops.aws/68d00a0b-2a7c-4d81-813a-0857fcda6e34/static/serverless-workshop.zip?Policy=eyJTdGF0ZW...19fV19&Key-Pair-Id=K3...QD&Signature=SRO...xwYClANHOzQ__"2022-09-02 10:11:52,512 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics 2022-09-02 10:11:52,512 | Using config file: samconfig.toml, config environment: default 2022-09-02 10:11:52,512 | Expand command line arguments to: 2022-09-02 10:11:52,512 | --name=serverless-workshop --location=https://static.us-east-1.prod.workshops.aws/68d00a0b-2a7c-4d81-813a-0857fcda6e34/static/serverless-workshop.zip?Policy=eyJTdGF0...zQ4M319fV19&Key-Pair-Id=K36Q...7QD&Signature=SROJkP...ClANHOzQ__ --package_type=Zip --output_dir=. 2022-09-02 10:11:52,512 | Parameters dict created with input given 2022-09-02 10:11:52,512 | {'template': 'https://static.us-east-1.prod.workshops.aws/68d00a0b-2a7c-4d81-813a-0857fcda6e34/static/serverless-workshop.zip?Policy=eyJTdGF0ZW1lbn...Q4M319fV19&Key-Pair-Id=K36...7QD&Signature=SROJ...YClANHOzQ__', 'output_dir': '.', 'no_input': False, 'extra_context': {'project_name': 'serverless-workshop', 'architectures': {'value': ['x86_64']}}} 2022-09-02 10:11:52,512 | Baking a new template with cookiecutter with all parameters 2022-09-02 10:11:52,512 | Template is not provided in context, skip adding project type metric 2022-09-02 10:11:52,512 | Sending Telemetry: {'metrics': [{'commandRun': {'requestId': 'fb618529-9b02-4de9-8b57-8c5f8ed3edde', 'installationId': '81da5cc0-a155-4908-b68d-8ee9abe09653', 'sessionId': '474d5007-2e4a-4064-bf9a-c41d5810d2c4', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.8.13', 'samcliVersion': '1.55.0', 'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam init', 'duration': 0, 'exitReason': 'InvalidLocationError', 'exitCode': 1}}]} 2022-09-02 10:11:52,759 | Telemetry response: 200 Error: The template location specified is not valid: https://static.us-east-1.prod.workshops.aws/68d00a0b-2a7c-4d81-813a-0857fcda6e34/static/serverless-workshop.zip?Policy=eyJTdGF0ZW1l...Q4M319fV19&Key-Pair-Id=K36...7QD&Signature=SROJkPKXr...8OuMUEdnAZ4AxwYClANHOzQ__