aws-amplify / aws-amplify/amplify-cli

Lambda Env variable should be added to default parameter value instread of `team-provider-info.json`

Open
#10,970 0 comments 0 reactions 0 assignees View on GitHub
feature-request functions p4 pending-review
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### Is this feature request related to a new or existing Amplify category?

function

### Is this related to another service?

Amplify Hosting

### Describe the feature you'd like to request

When enabling branch auto-detection on Amplify Hosting, Amplify automatically generates a new branch if the pattern matches. But the problem is that env variable won't be carried over to the new env, then it shows error which says that `Parameters: [ENV VALUE KEY] must have values`

### Describe the solution you'd like

Lambda env variable should be added to default value of parameter at `amplify/backend/function/{resourcename}/{resourcename}-cloudformation-template.json` like below.

```json
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Lambda Function resource stack creation using Amplify CLI",
"Parameters": {
"CloudWatchRule": {
"Type": "String",
"Default": "NONE",
"Description": " Schedule Expression"
},
"deploymentBucketName": {
"Type": "String"
},
"env": {
"Type": "String"
},
"s3Key": {
"Type": "String"
},
"fuga": {
"Type": "String",
"Default": "HOGE"
}
},
```

### Describe alternatives you've considered

Or we can make it default to carry over existing env value to a new env when creating a new env, but this will be complicated since Amplify Hosting doesn't know the current Amplify env.

### Additional context

_No response_

### Is this something that you'd be interested in working on?

- [X] 👋 I may be able to implement this feature request

### Would this feature include a breaking change?

- [ ] ⚠️ This feature might incur a breaking change

Contributor guide

Open the contributing guide

Research direction

Start with amplify/backend/function/{resourcename}/{resourcename}-cloudformation-template.json and trace how Lambda environment parameters are generated for Amplify Hosting branch auto-detection. Reproduce a matching new branch, then verify that the generated template supplies defaults for configured environment values without the “Parameters must have values” error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
backend, cli, cloud, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.