aws-amplify / aws-amplify/amplify-cli

"amplify add notifications" fails when pushing changes to backend

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

Description

### Describe the bug

I have an amplify project that I need to add push notifications to. After running the steps listed in the docs (which are not aligned to the actual steps) I get this:

```
⚠️ Pinpoint resource is not created
⚠️ Run "amplify push" to deploy the Pinpoint resource and then retry...
Channel APNS requires a Pinpoint resource in the cloud. Proceeding to deploy Auth and Pinpoint resources...

Current Environment: staging

┌──────────┬───────────────────┬───────────┬───────────────────┐
│ Category │ Resource name │ Operation │ Provider plugin │
├──────────┼───────────────────┼───────────┼───────────────────┤
│ Auth │ BusinessDashboard │ Update │ awscloudformation │
└──────────┴───────────────────┴───────────┴───────────────────┘

Deployment failed.
Deploying root stack BusinessDashboard [ ---------------------------------------- ] 0/4
amplify-businessdashboard-sta… AWS::CloudFormation::Stack UPDATE_ROLLBACK_COMPLETE_CLEA… Wed Apr 05 2023 16:25:07…
authBusinessDashboard AWS::CloudFormation::Stack UPDATE_FAILED Wed Apr 05 2023 16:24:09…
apiBusinessDashboard AWS::CloudFormation::Stack UPDATE_FAILED Wed Apr 05 2023 16:24:08…
Deployed auth BusinessDashboard [ ======================================== ] 11/11

🛑 The following resources failed to deploy:
Resource Name: apiBusinessDashboard (AWS::CloudFormation::Stack)
Event Type: update
Reason: Parameters: [unauthRoleName, AuthCognitoUserPoolId, authRoleName] must have values
```

I tried removing auth category, tried on a new project, tried to use an existing pinpoint project, nothing works.

Besides, why the "Auth" category needs to be updated to use push notifications?

### Steps To Reproduce

```swift
Steps to reproduce the behavior:
1. run `amplify add notifications`
2. Choose the notification channel to enable · APNS |  Apple Push Notifications
3. Provide your pinpoint resource name: "myprojectname"
4. Apps need authorization to send analytics events. Do you want to allow guests and unauthenticated use
rs to send analytics events? (we recommend you allow this when getting started) "Yes"
```

### Expected behavior

Notification category is added

### Amplify Framework Version

2.6.0

### Amplify Categories

Analytics

### Dependency manager

Swift PM

### Swift version

5.6.1

### CLI version

11.0.3

### Xcode version

14.1

### Relevant log output

```shell

Log Messages

2023-04-05T13:23:35.504Z|info : amplify add notifications
2023-04-05T13:23:35.551Z|info : amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2023-04-05T13:23:39.674Z|error :
UnknownFault
2023-04-05T13:23:42.321Z|info : amplify add notifications
2023-04-05T13:23:42.365Z|info : amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2023-04-05T13:23:54.374Z|info : amplify-provider-awscloudformation.push-resources.uploadTemplateToS3.s3.uploadFile([{"Key":"[***]ify-[***]fn-[***]ates/[***]th/[***]shboard-[***]mation-[***]e.json"}])
2023-04-05T13:23:54.375Z|info : amplify-provider-awscloudformation.aws-s3.uploadFile.s3.putObject([{"Body":{"_readableState":{"objectMode":false,"highWaterMark":65536,"buffer":{"head":null,"tail":null,"length":0},"length":0,"pipes":[],"flowing":null,"ended":false,"endEmitted":false,"reading":false,"sync":true,"needReadable":false,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"errorEmitted":false,"emitClose":true,"autoDestroy":false,"destroyed":false,"errored":null,"closed":false,"closeEmitted":false,"defaultEncoding":"utf8","awaitDrainWriters":null,"multiAwaitDrain":false,"readingMore":false,"dataEmitted":false,"decoder":null,"encoding":null},"_events":{},"_eventsCount":1,"path":"/Users/doron/projects/personal/business-dashboard-ios/amplify/backend/awscloudformation/build/auth/BusinessDashboard/build/BusinessDashboard-cloudformation-template.json","fd":null,"flags":"r","mode":438,"end":null,"autoClose":true,"bytesRead":0,"closed":false},"Key":"[***]ify-[***]fn-[***]ates/[***]th/[***]shboard-[***]mation-[***]e.json","Bucket":"[***]ify-[***]shboard-[***]ing-[***]35-[***]ment"}])
2023-04-05T13:23:58.735Z|info : amplify-provider-awscloudformation.aws-cfn.updateCloudFormationNestedStack(["/Users/doron/projects/personal/business-dashboard-ios/amplify/backend/awscloudformation","/Users/doron/projects/personal/business-dashboard-ios/amplify/backend/awscloudformation/build/awscloudformation/build/root-cloudformation-stack.json"])
2023-04-05T13:23:58.742Z|info : amplify-provider-awscloudformation.aws-cfn.updateResourceStack.s3.uploadFile([{}])
2023-04-05T13:23:58.742Z|info : amplify-provider-awscloudformation.aws-s3.uploadFile.s3.putObject([{"Body":{"_readableState":{"objectMode":false,"highWaterMark":65536,"buffer":{"head":null,"tail":null,"length":0},"length":0,"pipes":[],"flowing":null,"ended":false,"endEmitted":false,"reading":false,"sync":true,"needReadable":false,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"errorEmitted":false,"emitClose":true,"autoDestroy":false,"destroyed":false,"errored":null,"closed":false,"closeEmitted":false,"defaultEncoding":"utf8","awaitDrainWriters":null,"multiAwaitDrain":false,"readingMore":false,"dataEmitted":false,"decoder":null,"encoding":null},"_events":{},"_eventsCount":1,"path":"/Users/doron/projects/personal/business-dashboard-ios/amplify/backend/awscloudformation/build/awscloudformation/build/[***]ot-[***]mation-[***]json","fd":null,"flags":"r","mode":438,"end":null,"autoClose":true,"bytesRead":0,"closed":false},"Key":"root-cloudformation-stack.json","Bucket":"[***]ify-[***]shboard-[***]ing-[***]35-[***]ment"}])
2023-04-05T13:24:00.045Z|info : amplify-provider-awscloudformation.aws-cfn.updateResourceStack.describeStack([{"StackName":"[***]ify-[***]shboard-[***]ing-[***]35"}])
2023-04-05T13:24:00.046Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]ify-[***]shboard-[***]ing-[***]35"}])
2023-04-05T13:24:00.714Z|info : amplify-provider-awscloudformation.aws-cfn.updateResourceStack.updateStack([{"StackName":"[***]ify-[***]shboard-[***]ing-[***]35"}])
2023-04-05T13:24:07.367Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]shboard-[***]ing-[***]35"}])
2023-04-05T13:24:09.665Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35-[***]ashboard-[***]MP4RT/[***]5120-[***]73-[***]ed-[***]c4-[***]c316f"}])
2023-04-05T13:24:09.766Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35-[***]Dashboard-[***]QGYP0/[***]dc70-[***]9e-[***]ed-[***]6c-[***]1e9f3"}])
2023-04-05T13:24:09.865Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35/[***]5ff0-[***]71-[***]ed-[***]6e-[***]a8a11"}])
2023-04-05T13:24:10.968Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35-[***]Dashboard-[***]QGYP0/[***]dc70-[***]9e-[***]ed-[***]6c-[***]1e9f3"}])
2023-04-05T13:24:11.067Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35-[***]ashboard-[***]MP4RT/[***]5120-[***]73-[***]ed-[***]c4-[***]c316f"}])
2023-04-05T13:24:12.360Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]shboard-[***]ing-[***]35"}])
2023-04-05T13:24:13.543Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35/[***]5ff0-[***]71-[***]ed-[***]6e-[***]a8a11"}])
2023-04-05T13:24:13.644Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35-[***]Dashboard-[***]QGYP0/[***]dc70-[***]9e-[***]ed-[***]6c-[***]1e9f3"}])
2023-04-05T13:24:13.743Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35-[***]ashboard-[***]MP4RT/[***]5120-[***]73-[***]ed-[***]c4-[***]c316f"}])
2023-04-05T13:24:14.643Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35-[***]Dashboard-[***]QGYP0/[***]dc70-[***]9e-[***]ed-[***]6c-[***]1e9f3"}])
2023-04-05T13:24:14.743Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35-[***]ashboard-[***]MP4RT/[***]5120-[***]73-[***]ed-[***]c4-[***]c316f"}])
2023-04-05T13:24:22.361Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]shboard-[***]ing-[***]35"}])
2023-04-05T13:24:23.563Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35/[***]5ff0-[***]71-[***]ed-[***]6e-[***]a8a11"}])
2023-04-05T13:24:23.664Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35-[***]Dashboard-[***]QGYP0/[***]dc70-[***]9e-[***]ed-[***]6c-[***]1e9f3"}])
2023-04-05T13:24:23.764Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35-[***]ashboard-[***]MP4RT/[***]5120-[***]73-[***]ed-[***]c4-[***]c316f"}])
2023-04-05T13:24:25.794Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35-[***]Dashboard-[***]QGYP0/[***]dc70-[***]9e-[***]ed-[***]6c-[***]1e9f3"}])
2023-04-05T13:24:25.894Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35-[***]ashboard-[***]MP4RT/[***]5120-[***]73-[***]ed-[***]c4-[***]c316f"}])
2023-04-05T13:24:42.362Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]shboard-[***]ing-[***]35"}])
2023-04-05T13:24:43.539Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35-[***]Dashboard-[***]QGYP0/[***]dc70-[***]9e-[***]ed-[***]6c-[***]1e9f3"}])
2023-04-05T13:24:43.638Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35/[***]5ff0-[***]71-[***]ed-[***]6e-[***]a8a11"}])
2023-04-05T13:24:43.739Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35-[***]ashboard-[***]MP4RT/[***]5120-[***]73-[***]ed-[***]c4-[***]c316f"}])
2023-04-05T13:24:45.693Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35-[***]Dashboard-[***]QGYP0/[***]dc70-[***]9e-[***]ed-[***]6c-[***]1e9f3"}])
2023-04-05T13:24:45.792Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35-[***]ashboard-[***]MP4RT/[***]5120-[***]73-[***]ed-[***]c4-[***]c316f"}])
2023-04-05T13:25:12.365Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]shboard-[***]ing-[***]35"}])
2023-04-05T13:25:14.522Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35/[***]5ff0-[***]71-[***]ed-[***]6e-[***]a8a11"}])
2023-04-05T13:25:40.060Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]shboard-[***]ing-[***]35"}])
2023-04-05T13:25:42.583Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]33:stack/[***]ify-[***]shboard-[***]ing-[***]35/[***]5ff0-[***]71-[***]ed-[***]6e-[***]a8a11"}])
2023-04-05T13:25:53.082Z|error : Failed to create Pinpoint resource for the given environment: Resource is not in the state stackUpdateComplete
PushResourcesFault: Failed to create Pinpoint resource for the given environment: Resource is not in the state stackUpdateComplete
2023-04-05T13:25:57.416Z|info : amplify version core {"version":true,"yes":false}
```

```

### Is this a regression?

No

### Regression additional context

_No response_

### Device

Simulator and real iOS 16 device

### iOS Version

iOS 16

### Specific to simulators

_No response_

### Additional context

_No response_

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.