aws / aws/aws-sam-cli-app-templates

bug: setting the prompted architectures generates an error

Open
#162 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
534
Forks
264
PR merge metrics
No merged PRs in 30d

Description

## Issue

I am running `SAM CLI, version 1.36.0` and when I try to input the `architectures` prompted by Cookiecutter I get an `Error: Unable to decode to JSON.` error. And this might not be intuitive for a first time user

```text
sam init --location cookiecutter-aws-sam-eventbridge-hello-java-gradle
project_name [Your EventBridge Starter app]: x
runtime [java11]:
architectures [default]: arm64
Error: Unable to decode to JSON.
```

## Work around

If I set the input to `{"value":["arm64"]}` for `architectures` then this works.

```text
sam init --location cookiecutter-aws-sam-eventbridge-hello-java-gradle
project_name [Your EventBridge Starter app]: x
runtime [java11]:
architectures [default]: {"value":["arm64"]}
```

Or if I pass in `architecture` in the cli and not enter anything in `architectures`:

```script
sam init --location java11/cookiecutter-aws-sam-eventbridge-hello-java-gradle --architecture arm64
```

## Possible Solution

- Change the `architectures` in `cookiecutter.json` to be a simple string value like `runtime`, this would mean change all of the templates and CLI

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with `sam init --location cookiecutter-aws-sam-eventbridge-hello-java-gradle` and the `architectures` value `arm64`. Start by inspecting the affected `cookiecutter.json` and the architecture handling in the CLI, then review the other templates mentioned by the proposed solution. Done means a plain `arm64` prompt works without breaking the documented JSON form or CLI option.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, java, python
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.