aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.81k stars 820 forks source link

Amplify cli tries to create Notifications even though they already exist. #11270

Closed ericstoecker closed 1 year ago

ericstoecker commented 1 year ago

Before opening, please confirm:

How did you install the Amplify CLI?

npm

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

v14.17.0

Amplify CLI Version

10.3.2

What operating system are you using?

macOS Monterey 12.6

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

No manual changes made

Amplify Categories

analytics, notifications

Amplify Commands

pull, push

Describe the bug

Expected behavior

after adding and setting up notifications on one device and pushing to the cloud, amplify should not try to set notifications up on a different device.

Reproduction steps

  1. create project and set up notifications with APNs and FCM on a device and push to cloud.

  2. on another device set up amplify cli and pull everything.

  3. cli will ask to choose authentication method (I then aborted the command)

    image
  4. my amplify-meta.json now contains the following

    image
  5. as you can see there is no "lastPushTimeStamp" so amplify probably believes that this resource is newly created. Also there is no other information except for the channels and service

  6. run amplify status

  7. should now look something like this

    image
  8. run amplify pull

  9. cli will ask to choose authentication method (I then aborted the command)

    image
  10. now the amplify-meta.json contains the following

    image
  11. setting "HasTokenKey" to "true" leads to amplify not trying to create notifications category

    image
  12. now change something in your project to be able to run amplify push (for example you can simply add a space in your schema.graphql)

  13. when running amplify pull again the cli again asks me again to choose an authentication method for APNs

  14. so theoretically I can push without recreating notifications. However this is not the expected behaviour and I don't want to do the above steps each time I have to push something.

  15. I have also figured out that for some reason running amplify env pull instead of just amplify pull leads to my amplify-meta.json looking again like this

    image

GraphQL schema(s)

```graphql # Put schemas below this line ```

Project Identifier

Project Identifier: 8e7ec6dac606d8af0b67897bb966c442

Log output

``` # Put your logs below this line ```

Additional information

Seems to be related to (or exactly the same as) #6408 but I couldn't comment or reopen this issue since it was closed. The solution there was to recreate the whole project. Since my project is already in production I would rather not do that.

Mentioum commented 1 year ago

We're also having this (or a similar) issue while using v10.x.x:

It resulted in us having too many Pinpoint policies being added to our auth role.
This prevented us pushing after a while with the error: can't have more than 10 policies per role

We manually deleted the invalid policies and duplicated pinpoint projects and downgraded to v9.2.1 until this is fixed.

Tagging @ralphkemp for reference.

InnovateWithEric commented 1 year ago

@ericstoecker @Mentioum - we're investigating

lazpavel commented 1 year ago

Hi @ericstoecker @Mentioum we have a RC out with a fix for this issue which you can find here: https://www.npmjs.com/package/@aws-amplify/cli/v/10.4.0-rc.43121b9b9.0 and we are working to push it to latest

josefaidt commented 1 year ago

Hey @ericstoecker it appears this was fixed with CLI 10.4.0, are you still experiencing this issue?

biller-aivy commented 1 year ago

Hey @ericstoecker it appears this was fixed with CLI 10.4.0, are you still experiencing this issue?

fixed for me with 10.4.0

ericstoecker commented 1 year ago

Hey @ericstoecker it appears this was fixed with CLI 10.4.0, are you still experiencing this issue?

fixed it for me too

RalphKemp commented 1 year ago

Thanks for fixing this so quickly, I'll give it a test today. Cheers

ykethan commented 1 year ago

Hey @ericstoecker, thank you for confirming. Closing the issue.