aws-amplify / aws-amplify/amplify-cli

Amplify CLI push fails to push to environment after removing env vars from function

Open
#12,114 9 comments 0 reactions 1 assignee Claimed by @pavellazar View on GitHub
bug functions multienv p2
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### How did you install the Amplify CLI?

npm

### If applicable, what version of Node.js are you using?

14.21.3

### Amplify CLI Version

10.7.3

### What operating system are you using?

Mac

### Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No

### Describe the bug

Updated function by removing environment variables and also pushed to my `dev` environment with `amplify push`. After moving to a different environment by changing branches and running `amplify env checkout {ENV_NAME}` and doing, `amplify push` again, the deployment fails

```
functionapi AWS::CloudFormation::Stack UPDATE_FAILED Mon Feb 27 2023 09:14:3
Deployed function AdminQueriesd8df3ab6 [ ======================================== ] 3/3
Deployed function S3Triggerc2f3c2fa [ ======================================== ] 3/3
Deployed function api [ ======================================== ] 5/5
Deployed function coreconsolecf3573d0PostAuthentication [ ======================================== ] 6/6

πŸ›‘ The following resources failed to deploy:
Resource Name: functionapi (AWS::CloudFormation::Stack)
Event Type: update
Reason: Parameters: [telemetryCoreCurrentStateTableBaseName, telemetryCamerasTableBaseName, videoCameraCoreTableBaseName, permissionsTableName, eventsTableBaseName, ddnsCameraTableBaseName, placeholder, notesTableBaseName, sessionsTableName, transcodedCameraCoreTableBaseName, aiCameraCoreTableBaseName, telemetryCoreTableBaseName] do not exist in the template
URL: https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/arn%3Aaws%3Acloudformation%3Aus-east-1%3A217822356980%3Astack%2Famplify-coreconsole-release-193550%2Fd06dfc00-256b-11ec-8516-0e6c55b6e46f/events

πŸ›‘ Resource is not in the state stackUpdateComplete
Name: functionapi (AWS::CloudFormation::Stack), Event Type: update, Reason: Parameters: [telemetryCoreCurrentStateTableBaseName, telemetryCamerasTableBaseName, videoCameraCoreTableBaseName, permissionsTableName, eventsTableBaseName, ddnsCameraTableBaseName, placeholder, notesTableBaseName, sessionsTableName, transcodedCameraCoreTableBaseName, aiCameraCoreTableBaseName, telemetryCoreTableBaseName] do not exist in the template
```

The error produced a session ID and also a report. Happy to share them just need to know how.

### Expected behavior

After checkout of the env that I want to deploy, deployment should be successful as it has been always when doing something similar.

### Reproduction steps

1. Update function with `amplify function update`
2. Select remove env vars and remove some of them
3. Push with `amplify push`
4. Move to a different branch and do `amplify env checkout release`
5. Push release environment `amplify push`

### Project Identifier

4d3029e4c61cca9982ff470ba7f8b44e

### Log output

```
# Put your logs below this line
(base) eebf1993@MacBook-Pro-4 coreconsole % amplify push
βœ” Successfully pulled backend environment release from the cloud.

Current Environment: release

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Category β”‚ Resource name β”‚ Operation β”‚ Provider plugin β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Function β”‚ api β”‚ Update β”‚ awscloudformation β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Analytics β”‚ coreconsole β”‚ No Change β”‚ awscloudformation β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Api β”‚ AdminQueries β”‚ No Change β”‚ awscloudformation β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Api β”‚ supportui β”‚ No Change β”‚ awscloudformation β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Auth β”‚ coreconsolecf3573d0 β”‚ No Change β”‚ awscloudformation β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Auth β”‚ userPoolGroups β”‚ No Change β”‚ awscloudformation β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Function β”‚ AdminQueriesd8df3ab6 β”‚ No Change β”‚ awscloudformation β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Function β”‚ S3Triggerc2f3c2fa β”‚ No Change β”‚ awscloudformation β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Function β”‚ coreconsolecf3573d0PostAuthentication β”‚ No Change β”‚ awscloudformation β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Hosting β”‚ S3AndCloudFront β”‚ No Change β”‚ awscloudformation β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Storage β”‚ fususcoreConsoleEvents β”‚ No Change β”‚ awscloudformation β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Storage β”‚ fususcoreConsoleSettings β”‚ No Change β”‚ awscloudformation β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Storage β”‚ supportUiContent β”‚ No Change β”‚ awscloudformation β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
? Are you sure you want to continue? Yes
⚠️ Warning: You've specified "*" as the "Resource" in api's custom IAM policy.
This will grant api the ability to perform secretsmanager:GetRandomPassword,secretsmanager:ListSecrets on ALL resources in this AWS Account.

Deployment failed.
Deploying root stack coreconsole [ ==================================------ ] 12/14
amplify-coreconsole-release-1… AWS::CloudFormation::Stack UPDATE_ROLLBACK_COMPLETE Mon Feb 27 2023 09:15:0
storagefususcoreConsoleSettin… AWS::CloudFormation::Stack UPDATE_COMPLETE Mon Feb 27 2023 09:14:4
storagefususcoreConsoleEvents AWS::CloudFormation::Stack UPDATE_COMPLETE Mon Feb 27 2023 09:14:4
analyticscoreconsole AWS::CloudFormation::Stack UPDATE_COMPLETE Mon Feb 27 2023 09:14:4
hostingS3AndCloudFront AWS::CloudFormation::Stack UPDATE_COMPLETE Mon Feb 27 2023 09:14:4
functionS3Triggerc2f3c2fa AWS::CloudFormation::Stack UPDATE_COMPLETE Mon Feb 27 2023 09:14:4
functioncoreconsolecf3573d0Po… AWS::CloudFormation::Stack UPDATE_COMPLETE Mon Feb 27 2023 09:14:4
authcoreconsolecf3573d0 AWS::CloudFormation::Stack UPDATE_COMPLETE Mon Feb 27 2023 09:14:4
authuserPoolGroups AWS::CloudFormation::Stack UPDATE_COMPLETE Mon Feb 27 2023 09:14:5
functionAdminQueriesd8df3ab6 AWS::CloudFormation::Stack UPDATE_COMPLETE Mon Feb 27 2023 09:14:5
apiAdminQueries AWS::CloudFormation::Stack UPDATE_COMPLETE Mon Feb 27 2023 09:14:5
storagesupportUiContent AWS::CloudFormation::Stack UPDATE_COMPLETE Mon Feb 27 2023 09:14:5
functionapi AWS::CloudFormation::Stack UPDATE_FAILED Mon Feb 27 2023 09:14:3
Deployed function AdminQueriesd8df3ab6 [ ======================================== ] 3/3
Deployed function S3Triggerc2f3c2fa [ ======================================== ] 3/3
Deployed function api [ ======================================== ] 5/5
Deployed function coreconsolecf3573d0PostAuthentication [ ======================================== ] 6/6

πŸ›‘ The following resources failed to deploy:
Resource Name: functionapi (AWS::CloudFormation::Stack)
Event Type: update
Reason: Parameters: [telemetryCoreCurrentStateTableBaseName, telemetryCamerasTableBaseName, videoCameraCoreTableBaseName, permissionsTableName, eventsTableBaseName, ddnsCameraTableBaseName, placeholder, notesTableBaseName, sessionsTableName, transcodedCameraCoreTableBaseName, aiCameraCoreTableBaseName, telemetryCoreTableBaseName] do not exist in the template
URL: https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/arn%3Aaws%3Acloudformation%3Aus-east-1%3A217822356980%3Astack%2Famplify-coreconsole-release-193550%2Fd06dfc00-256b-11ec-8516-0e6c55b6e46f/events

πŸ›‘ Resource is not in the state stackUpdateComplete
Name: functionapi (AWS::CloudFormation::Stack), Event Type: update, Reason: Parameters: [telemetryCoreCurrentStateTableBaseName, telemetryCamerasTableBaseName, videoCameraCoreTableBaseName, permissionsTableName, eventsTableBaseName, ddnsCameraTableBaseName, placeholder, notesTableBaseName, sessionsTableName, transcodedCameraCoreTableBaseName, aiCameraCoreTableBaseName, telemetryCoreTableBaseName] do not exist in the template

```

### Additional information

_No response_

### Before submitting, please confirm:

- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.