aws-amplify / amplify-category-api

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development. This plugin provides functionality for the API category, allowing for the creation and management of GraphQL and REST based backends for your amplify project.
https://docs.amplify.aws/
Apache License 2.0
88 stars 76 forks source link

Blocked error! Syntax Error: Expected ":", found "@" when executing amplify push and amplify pull, also admin.amplifyapp.com/admin/.. data-manager doesnt work #2718

Open chirpavel opened 2 months ago

chirpavel commented 2 months ago

How did you install the Amplify CLI?

npm

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

v20.12.2

Amplify CLI Version

12.12.4

What operating system are you using?

Windows

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

I added this model:

type SubscriptionPlan @model 
  @auth(
    rules: [
      {allow: private, provider: iam, operations: [read, create, update]},
      {allow: groups, groups: ["eu-central-admins"], operations: [read, create, update, delete]}
    ]
  ) {
  id: ID!
  branchId: ID!
  prevSubscriptionPlan: String
  subscriptionPlan: String
  price: Float
  paidAmount: Float
  isFake: Boolean
  duration: Int
  convertedDays: Int
  extraDays: Int
  expiryDate: AWSDateTime
  detailsSnapshot: String
  autoRenewal: Boolean
  owner: String
  type: String!
    String @default(value: "SP")
    @index(
      name: "subscriptionPlansByDate"
      queryField: "subscriptionPlansByDate"
      sortKeyFields: ["createdAt"]
    )
  createdAt: String!
}

This part to sort by createdAt:
type: String!
    String @default(value: "SP")
    @index(
      name: "subscriptionPlansByDate"
      queryField: "subscriptionPlansByDate"
      sortKeyFields: ["createdAt"]
    )
  createdAt: String!

### Describe the bug

When I added this part:
type: String!
    String @default(value: "SP")
    @index(
      name: "subscriptionPlansByDate"
      queryField: "subscriptionPlansByDate"
      sortKeyFields: ["createdAt"]
    )
  createdAt: String!

to the end of SubscriptionPlan model and execute amplify push - nothing work: amplify push and amplify pull return error: Syntax Error: Expected ":", found "@"

The same error in the browser: https://eu-central-1.admin.amplifyapp.com/admin/d2bvp8o95pga13/staging/data-manager
GraphQLError: Syntax Error: Expected ":", found "@".
The error may be correlated with this previous error:
GraphQLError: Syntax Error: Expected ":", found "@".
    at Sa (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:161300)
    at t.expectToken (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:189570)
    at t.parseFieldDefinition (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:183142)
    at t.optionalMany (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:190428)
    at t.parseFieldsDefinition (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:182944)
    at t.parseObjectTypeDefinition (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:182172)
    at t.parseTypeSystemDefinition (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:180669)
    at t.parseDefinition (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:174398)
    at t.many (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:190559)
    at t.parseDocument (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:174002)
    at https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:195496
    at https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:1185836
    at f (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:1184785)
    at https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:1185969
    at f (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:1184785)
    at Object.current (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:309635)
    at Object.e [as onStateChange] (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:1188845)
    at Object.i [as callback] (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:1180074)
    at https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:1179674
    at ll (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:206125)
    at Object.notify (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:1179643)
    at Object.notifyNestedSubs (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:1180240)
    at Object._ [as onStateChange] (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:1181633)
    at Object.i [as callback] (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:1180074)
    at https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:1179674
    at ll (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:206125)
    at Object.notify (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:1179643)
    at Object.notifyNestedSubs (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:1180240)
    at i (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:1180074)
    at E (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:276448)
    at https://eu-central-1.admin.amplifyapp.com/static/js/44.824f95d4.chunk.js:3:460334
    at https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:102575
    at dispatch (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:278216)
    at https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:1307011
    at https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:1299533
    at Object.next (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:1299638)
    at a (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:1300278)

    at Sa (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:161300)
    at t.expectToken (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:189570)
    at t.parseFieldDefinition (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:183142)
    at t.optionalMany (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:190428)
    at t.parseFieldsDefinition (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:182944)
    at t.parseObjectTypeDefinition (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:182172)
    at t.parseTypeSystemDefinition (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:180669)
    at t.parseDefinition (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:174398)
    at t.many (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:190559)
    at t.parseDocument (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:174002)
    at https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:195496
    at https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:1185836
    at f (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:1184785)
    at https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:1185969
    at f (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:1184785)
    at https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:309635
    at https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:1188491
    at https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:1189025
    at Eg (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:308847)
    at Xa (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:170059)
    at Go (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:178951)
    at vs (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:217401)
    at El (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:208925)
    at fl (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:208850)
    at sl (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:205859)
    at https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:157337
    at t.unstable_runWithPriority (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:232575)
    at ji (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:157046)
    at $i (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:157282)
    at Qi (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:157217)
    at ll (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:206150)
    at Object.notify (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:1179643)
    at Object.notifyNestedSubs (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:1180240)
    at i (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:1180074)
    at E (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:276448)
    at https://eu-central-1.admin.amplifyapp.com/static/js/44.824f95d4.chunk.js:3:460334
    at https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:102575
    at dispatch (https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js:4:278216)
    at https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:1307011
    at https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:1299533
    at Object.next (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:1299638)
    at a (https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js:4:1300278)

44.824f95d4.chunk.js:3 
 GET https://eu-central-1.admin.amplifyapp.com/static/js/44.824f95d4.chunk.js.map 404 (Not Found)
44.824f95d4.chunk.js:3 
 GET https://eu-central-1.admin.amplifyapp.com/static/js/38.948fc0bf.chunk.js.map 404 (Not Found)
44.824f95d4.chunk.js:3 
 GET https://eu-central-1.admin.amplifyapp.com/static/js/37.76c182c0.chunk.js.map 404 (Not Found)
44.824f95d4.chunk.js:3 
 POST https://o4505399133929472.ingest.sentry.io/api/4505399136092160/envelope/?s…bae4b0ae2f&sentry_version=7&sentry_client=sentry.javascript.react%2F7.57.0 429 (Too Many Requests)

 Session Identifier: 961eee15-0da6-458b-a4f2-2fb37d52f7ac
 Session Identifier: 9c55993b-53d7-49d7-89ca-c1cd94796a01
 Session Identifier: fb8e6830-83a8-4dec-808b-057654562da7
 Session Identifier: f17812a0-b421-4cec-be01-be2850c0a6a3

amplify diagnose --send-report
✅ Report saved: C:\Users\chirp\AppData\Local\Temp\SplitPay\report-1721509444518.zip
√ Done

Project Identifier: 70952c35bc147986b145b568d0636b2e

After error i tried amplify push --force and --no-gql-override flag Nothing helps

Expected behavior

Sorting by date like in the doc: https://docs.amplify.aws/gen1/javascript/build-a-backend/graphqlapi/best-practice/query-with-sorting/

Reproduction steps

  1. Add this model:

    type SubscriptionPlan @model 
    @auth(
    rules: [
      {allow: private, provider: iam, operations: [read, create, update]},
      {allow: groups, groups: ["eu-central-admins"], operations: [read, create, update, delete]}
    ]
    ) {
    id: ID!
    branchId: ID!
    prevSubscriptionPlan: String
    subscriptionPlan: String
    price: Float
    paidAmount: Float
    isFake: Boolean
    duration: Int
    convertedDays: Int
    extraDays: Int
    expiryDate: AWSDateTime
    detailsSnapshot: String
    autoRenewal: Boolean
    owner: String
    type: String!
    String @default(value: "SP")
    @index(
      name: "subscriptionPlansByDate"
      queryField: "subscriptionPlansByDate"
      sortKeyFields: ["createdAt"]
    )
    createdAt: String!
    }
  2. amplify push

  3. Change the model

  4. amplify push

Project Identifier

Project Identifier: 70952c35bc147986b145b568d0636b2e

Log output

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

Additional information

data-manager-screenshot 2024-07-21 050628

Data manager doesnt work at all!

Before submitting, please confirm:

chirpavel commented 2 months ago

Now I tried to:

  1. Clear the SubscriptionPlan model from AppSync Schema. No effect
  2. Delete ui-components folder from src (maybe there some errors). No effect
  3. Delete all data models in local schema and amplify push. No effect
  4. Of cause I tried to restore from git. No effect

I cant use Amplify Data Manager, white blank page with errors in console

Help me please ASAP

chirpavel commented 2 months ago

After many attempts to get into the Data manager, I was able to. It opened without tables, I created a single one for testing and clicked Deploy. An error was displayed during deployment

Step 1: Deployment failed
Close
GraphQL API SplitPay already exists in the project","resolution":"Use amplify update api to make modifications","link":"https://docs.amplify.aws/cli/project/troubleshooting/"}

I tried update api in cli, but the same error:
**amplify update api**

? Select from one of the below mentioned services: GraphQL

General information
- Name: SplitPay
- API endpoint: https://qoju2h4htrh3xitgusj476izcy.appsync-api.eu-central-1.amazonaws.com/graphql

Authorization modes
- Default: Amazon Cognito User Pool
- IAM

Conflict detection (required for DataStore)
- Conflict resolution strategy: Auto Merge

? Select a setting to edit Authorization modes
? Choose the default authorization type for the API Amazon Cognito User Pool
Use a Cognito user pool configured as a part of this project.
? Configure additional auth types? Yes
? Choose the additional authorization types you want to configure for the API API key, IAM
API key configuration
√ Enter a description for the API key: · No desc
√ After how many days from now the API key should expire (1-365): · 5
🛑 Syntax Error: Expected ":", found "@".
chirpavel commented 2 months ago

amplify pull shows this error several times:

amplify pull --appId d2bXXXX --envName staging

Pre-pull status:

    Current Environment: staging

┌──────────┬──────────────────────────────┬───────────┬───────────────────┐
│ Category │ Resource name                │ Operation │ Provider plugin   │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Api      │ SplitPay                     │ Update    │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Function │ ChangeSubscriptionPlanLambda │ Update    │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Auth     │ SplitPay                     │ No Change │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Function │ CognitoSignupTriggerLambda   │ No Change │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Function │ RMSIikoGetMenuLambda         │ No Change │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Storage  │ s3splitpaystoragestaging     │ No Change │ awscloudformation │
└──────────┴──────────────────────────────┴───────────┴───────────────────┘

⚠️ Local changes detected.
⚠️ Pulling changes from the cloud will override your local changes.
? Are you sure you would like to continue? Yes
√ Successfully pulled backend environment staging from the cloud.
Browserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
✅ 
GraphQLError: Syntax Error: Expected ":", found "@".
× Failed to sync the following components: MenuItemCreateForm, UserProfileUpdateForm, MenuItemSizeUpdateForm, MenuItemSizeCreateForm, BranchPublicInfoUpdateForm, MenuGroupUpdateForm, MenuGroupCreateForm, BranchOperatingHoursUpdateForm, MenuItemUpdateForm
GraphQLError: Syntax Error: Expected ":", found "@".
🛑 Syntax Error: Expected ":", found "@".

Resolution: Please report this issue at https://github.com/aws-amplify/amplify-cli/issues and include the project identifier from: 'amplify diagnose --send-report'
Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

Session Identifier: 6e0a7efe-dd6c-4c5a-92c2-2a7ab3433804

✅ Report saved: C:\Users\chirp\AppData\Local\Temp\SplitPay\report-1721513470733.zip

√ Done

Project Identifier: 70952c35bc147986b145b568d0636b2e
chirpavel commented 2 months ago

image

chirpavel commented 2 months ago

data-manager-screenshot 2024-07-21 144238 At this step AWS sends model with mistake (after decoding):

type SubscriptionPlan @model 
  @auth(
    rules: [
      {allow: private, provider: iam, operations: [read, create, update]},
      {allow: groups, groups: ["eu-central-admins"], operations: [read, create, update, delete]}
    ]
  ) {
  id: ID!
  branchId: ID!
  prevSubscriptionPlan: String
  subscriptionPlan: String
  price: Float
  paidAmount: Float
  isFake: Boolean
  duration: Int
  convertedDays: Int
  extraDays: Int
  expiryDate: AWSDateTime
  detailsSnapshot: String
  autoRenewal: Boolean
  owner: String
  type: String!
  String @default(value: "SP")
  @index(
    name: "subscriptionPlansByDate"
    queryField: "subscriptionPlansByDate"
    sortKeyFields: ["createdAt"]
  )
  createdAt: String!
}

Mistake is here: **String @default(value: "SP")**

ykethan commented 1 month ago

Hey,👋 thanks for raising this! I'm going to transfer this over to our API repository for better assistance.

But to mitigate the issue you will need to download the current-cloud-backend.zip from the Amplify S3 deployment bucket, update the schema and carefully re-upload zip. Then running the pull locally should build the schema.

AnilMaktala commented 1 month ago

Hey @chirpavel, Thanks for raising this. After reviewing your field that you are trying to the model seems to be not valid GraphQL format. Can you please update the field to like below and let us know if it resovles your issue.

 type: String! @default(value: "SP")
  @index(
    name: "subscriptionPlansByDate"
    queryField: "subscriptionPlansByDate"
    sortKeyFields: ["createdAt"]
  )
chirpavel commented 1 month ago

Thank you very much for your answers!!!

Yes, I know there was a typo in the model. Following the advice, I downloaded the #current-cloud-backend.zip archive from the deployment bucket. Changed the model to the correct one:

type SubscriptionPlan @model
  @auth(
    rules: [
      {allow: private, provider: iam, operations: [read, create, update]},
      {allow: groups, groups: ["eu-central-admins"], operations: [read, create, update, delete]}
    ]
  ) {
id: ID!
name: String
branchId: ID!
prevSubscriptionPlan: String
subscriptionPlan: String
price: Float
paidAmount: Float
isFake: Boolean
duration: Int
convertedDays: Int
extraDays: Int
expiryDate: AWSDateTime
detailsSnapshot: String
autoRenewal: Boolean
owner: String
}

I deleted all the bad fields at the end and packed it back into the file. Without deleting the file, I uploaded it under the same name (I enabled versioning first, just in case)

repacked-schema-screenshot 2024-07-26 120104

After that, the Syntax Error: Expected ":", found "@" error disappeared! But not everything is so good.

To make changes to the API, I added the "name" field and run amplify push:

\ Fetching updates to backend environment: staging from the cloud.⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): BranchOperatingHours: [owner], BranchPublicInfo: [owner], UserProfile: [owner], MenuItemModifier: [owner], MenuItemSize: [owner], MenuItem: [owner], MenuGroup: [owner], Branch: [owner]. If this is not intentional, you may want to apply field-level authorization rules to these fields. To read more: https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access.
/ Fetching updates to backend environment: staging from the cloud.✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema
√ Successfully pulled backend environment staging from the cloud.
\ Building resource api/SplitPay⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): BranchOperatingHours: [owner], BranchPublicInfo: [owner], UserProfile: [owner], MenuItemModifier: [owner], MenuItemSize: [owner], MenuItem: [owner], MenuGroup: [owner], Branch: [owner]. If this is not intentional, you may want to apply field-level authorization rules to these fields. To read more: https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access.
- Building resource api/SplitPay✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema

    Current Environment: staging

┌──────────┬──────────────────────────────┬───────────┬───────────────────┐
│ Category │ Resource name                │ Operation │ Provider plugin   │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Api      │ SplitPay                     │ Update    │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Function │ ChangeSubscriptionPlanLambda │ Update    │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Auth     │ SplitPay                     │ No Change │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Function │ CognitoSignupTriggerLambda   │ No Change │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Function │ RMSIikoGetMenuLambda         │ No Change │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Storage  │ s3splitpaystoragestaging     │ No Change │ awscloudformation │
└──────────┴──────────────────────────────┴───────────┴───────────────────┘
√ Are you sure you want to continue? (Y/n) · yes
⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): BranchOperatingHours: [owner], BranchPublicInfo: [owner], UserProfile: [owner], MenuItemModifier: [owner], MenuItemSize: [owner], MenuItem: [owner], MenuGroup: [owner], Branch: [owner]. If this is not intentional, you may want to apply field-level authorization rules to these fields. To read more: https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access.
✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema
| Building resource api/SplitPay⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): BranchOperatingHours: [owner], BranchPublicInfo: [owner], UserProfile: [owner], MenuItemModifier: [owner], MenuItemSize: [owner], MenuItem: [owner], MenuGroup: [owner], Branch: [owner]. If this is not intentional, you may want to apply field-level authorization rules to these fields. To read more: https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access.
/ Building resource api/SplitPay✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema
? Do you want to update code for your updated GraphQL API Yes
? Do you want to generate GraphQL statements (queries, mutations and subscription) based on your schema types?
This will overwrite your current graphql queries, mutations and subscriptions Yes

Deployment completed.
Deploying api SplitPay [ =======--------------------------------- ] 4/24
        GraphQLAPITransformerSchema3C… AWS::AppSync::GraphQLSchema    UPDATE_IN_PROGRESS             Fri Jul 26 2024 12:23:43…
        AuthRolePolicy02A05DD8DC       AWS::IAM::ManagedPolicy        UPDATE_IN_PROGRESS             Fri Jul 26 2024 12:23:43…
        AuthRolePolicy01921FC820       AWS::IAM::ManagedPolicy        UPDATE_IN_PROGRESS             Fri Jul 26 2024 12:23:43…
        GraphQLAPIDefaultApiKey215A6D… AWS::AppSync::ApiKey           UPDATE_IN_PROGRESS             Fri Jul 26 2024 12:23:43…

Rolled back (2 of 2)
🛑 ["Index: 1 State: {\"deploy\":\"waitingForDeployment\"} Message: Resource is not in the state stackUpdateComplete","Index: 0 State: {\"rollback\":\"rollingBack\"} Message: Stack:arn:aws:cloudformation:eu-central-1:675795832684:stack/amplify-splitpay-staging-151233-apiSplitPay-16AD5QGQ6UTRM/158a35d0-d314-11ee-9cef-064928585b17 is in UPDATE_ROLLBACK_FAILED state and can not be updated."]

Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

Session Identifier: 558f4ebc-ee61-4332-a94e-90abed980eb0

✅ Report saved: C:\Users\chirp\AppData\Local\Temp\SplitPay\report-1721967974818.zip

√ Done

Project Identifier: 70952c35bc147986b145b568d0636b2e

Sending report:

PS C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay> amplify diagnose --send-report

Learn more at https://docs.amplify.aws/cli/reference/diagnose/

✅ Report saved: C:\Users\chirp\AppData\Local\Temp\SplitPay\report-1721968044142.zip

√ Done

Project Identifier: 70952c35bc147986b145b568d0636b2e

After these actions, the page https://eu-central-1.admin.amplifyapp.com/admin/ХХХ/staging/datastore with the data model began to open

I decided to delete the SubscriptionPlan model completely. I checked before Deploying that the model disappeared in the "GraphQL schema" mode. But the deployment quickly ended with an error:

Step 1: Deployment failed
Stack:arn:aws:cloudformation:eu-central-1:675795832684:stack/amplify-splitpay-staging-151233/a3ae6d40-d0cb-11ee-a2e7-020aa4f89a6d is in UPDATE_ROLLBACK_FAILED state and cannot be updated

deployment-failed-screenshot 2024-07-26 123645

If I try not to delete, but to add 1 string field "name" in the web console, the deployment ends with such an error:

Stack:arn:aws:cloudformation:eu-central-1:675795832684:stack/amplify-splitpay-staging-151233-apiSplitPay-16AD5QGQ6UTRM/158a35d0-d314-11ee-9cef-064928585b17 is in UPDATE_ROLLBACK_FAILED state and can not be updated

Attempts to delete the model locally and execute "amplify push" finished like this (without success):

amplify push -y --allow-destructive-graphql-schema-updates
- Building resource api/SplitPay⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): BranchOperatingHours: [owner], BranchPublicInfo: [owner], UserProfile: [owner], MenuItemModifier: [owner], MenuItemSize: [owner], MenuItem: [owner], MenuGroup: [owner], Branch: [owner]. If this is not intentional, you may want to apply field-level authorization rules to these fields. To read more: https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access.
/ Building resource api/SplitPay✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema
√ Successfully pulled backend environment staging from the cloud.
/ Building resource api/SplitPay⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): BranchOperatingHouurs: [owner], BranchPublicInfo: [owner], UserProfile: [owner], MenuItemModifier: [owner], MenuItemSize: [owner], MenuItem: [owner], MenuGroup: [owner], Branch: [owner]. If this is not intentional, you may want to apply field-level authorization rules to these fields. To read more: https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access.
/ Building resource api/SplitPay✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema

    Current Environment: staging

┌──────────┬──────────────────────────────┬───────────┬───────────────────┐
│ Category │ Resource name                │ Operation │ Provider plugin   │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Api      │ SplitPay                     │ Update    │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Function │ ChangeSubscriptionPlanLambda │ Update    │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Auth     │ SplitPay                     │ No Change │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Function │ CognitoSignupTriggerLambda   │ No Change │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Function │ RMSIikoGetMenuLambda         │ No Change │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Storage  │ s3splitpaystoragestaging     │ No Change │ awscloudformation │
└──────────┴──────────────────────────────┴───────────┴───────────────────┘
⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): BranchOperatingHours: [owner], BranchPublicInfo: [[owner], UserProfile: [owner], MenuItemModifier: [owner], MenuItemSize: [owner], MenuItem: [owner], MenuGroup: [owner], Branch: [owner]. If this is not intentional, you may want to apply field-level authorization rules to these fields. To read more: https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access.
✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema
/ Building resource api/SplitPay⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): BranchOperatingHouurs: [owner], BranchPublicInfo: [owner], UserProfile: [owner], MenuItemModifier: [owner], MenuItemSize: [owner], MenuItem: [owner], MenuGroup: [owner], Branch: [owner]. If this is not intentional, you may want to apply field-level authorization rules to these fields. To read more: https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access.
\ Building resource api/SplitPay✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema

Deploying resources into staging environment. This will take a few minutes. ⠋
Deploying root stack SplitPay [ ---------------------------------------- ] 0/7
Deploying api SplitPay [ ---------------------------------------- ] 0/23
Deploying function CognitoSignupTriggerLambda [ ---------------------------------------- ] 0/4
Deploying resources into staging environment. This will take a few minutes. ⠙
Deploying root stack SplitPay [ ---------------------------------------- ] 0/7
Deploying api Deploying resources into staging environment. This will take a few minutes. ⠹
Deploying root stack SplitPay [ ---------------------------------------- ] 0/7
Deploying api SplitPay [ ---------------------------------------- ] 0/23
Deploying funDeploying resources into staging environment. This will take a few minutes. ⠼
Deploying root stack SplitPay [ ---------------------------------------- ] 0/7
Deploying api SplitPay [ ---------------------------------------- ] 0/23
Deploying function CognitoSignupTriggerLambda [ ---------------------------------------- ] 0/4
Deploying function RMSIikoGetMenuLambda [ ---------------------------------------- ] 0/4
Deploying function ChangeSubscriptionPlanLambda [ ---------------------------------------- ] 0/4
√ Done

Project Identifier: 70952c35bc147986b145b568d0636b2e

amplify pull finished without error:

amplify pull   
⚠️ Local changes detected.
⚠️ Pulling changes from the cloud will override your local changes.
? Are you sure you would like to continue? Yes
- Building resource api/SplitPay⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): BranchOperatingHours: [owner], BranchPublicInfo: [owner], UserProfile: [owner], MenuItemModifier: [owner], MenuItemSize: [owner], MenuItem: [owner], MenuGroup: [owner], Branch: [owner]. If this is not intentional, you may want to apply field-level authorization rules to these fields. To read more: https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access.
/ Building resource api/SplitPay✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema        
√ Successfully pulled backend environment staging from the cloud.
Browserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
✅
⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): BranchOperatingHours: [owner], BranchPublicInfo: [owner], UserProfile: [owner], MenuItemModifier: [owner], MenuItemSize: [owner], MenuItem: [owner], MenuGroup: [owner], Branch: [owner]. If this is not intentional, you may want to apply field-level authorization rules to these fields. To read more: https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access.
✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema        
√ Synced UI components.
⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): BranchOperatingHours: [owner], BranchPublicInfo: [owner], UserProfile: [owner], MenuItemModifier: [owner], MenuItemSize: [owner], MenuItem: [owner], MenuGroup: [owner], Branch: [ownner]. If this is not intentional, you may want to apply field-level authorization rules to these fields. To read more: https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access.
✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema        
Successfully generated models. Generated models can be found in C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\src\models
Post-pull status:

    Current Environment: staging

┌──────────┬──────────────────────────────┬───────────┬───────────────────┐
│ Category │ Resource name                │ Operation │ Provider plugin   │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Api      │ SplitPay                     │ No Change │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Auth     │ SplitPay                     │ No Change │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Function │ CognitoSignupTriggerLambda   │ No Change │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Function │ RMSIikoGetMenuLambda         │ No Change │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Function │ ChangeSubscriptionPlanLambda │ No Change │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Storage  │ s3splitpaystoragestaging     │ No Change │ awscloudformation │
└──────────┴──────────────────────────────┴───────────┴───────────────────┘

⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): BranchOperatingHours: [owner], BranchPublicInfo: [owner], UserProfile: [owner], MenuItemModifier: [owner], MenuItemSize: [owner], MenuItem: [owner], MenuGroup: [owner], Branch: [owner]. If this is not intentional, you may want to apply field-level authorization rules to these fields. To read more: https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access.
✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema        
√ Synced UI components.

After the amplify pull command, I added one more "name" field to the SubscriptionPlan model and ran the amplify push command, it finished with error:

amplify push -y
/ Building resource api/SplitPay⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): BranchOperatingHours: [owner], BranchPublicInfo: [owner], UserProfile: [owner], MenuItemModifier: [owner], MenuItemSize: [owner], MenuItem: [owner], MenuGroup: [owner], Branch: [owner]. If this is not intentional, you may want to apply field-level authorization rules to these fields. To read more: https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access.
\ Building resource api/SplitPay✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema
√ Successfully pulled backend environment staging from the cloud.
- Building resource api/SplitPay⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): BranchOperatingHours: [owner], BranchPublicInfo: [owner], UserProfile: [owner], MenuItemModifier: [owner], MenuItemSize: [owner], MenuItem: [owner], MenuGroup: [owner], Branch: [owner]. If this is not intentional, you may want to apply field-level authorization rules to these fields. To read more: https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access.
/ Building resource api/SplitPay✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema

    Current Environment: staging

┌──────────┬──────────────────────────────┬───────────┬───────────────────┐
│ Category │ Resource name                │ Operation │ Provider plugin   │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Api      │ SplitPay                     │ Update    │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Auth     │ SplitPay                     │ No Change │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Function │ CognitoSignupTriggerLambda   │ No Change │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Function │ RMSIikoGetMenuLambda         │ No Change │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Function │ ChangeSubscriptionPlanLambda │ No Change │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Storage  │ s3splitpaystoragestaging     │ No Change │ awscloudformation │
└──────────┴──────────────────────────────┴───────────┴───────────────────┘
⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): BranchOperatingHours: [owner], BranchPublicInfo: [owner], UserProfile: [owner], MenuItemModifier: [owner], MenuItemSize: [owner], MenuItem: [owner], MenuGroup: [owner], Branch: [ownner]. If this is not intentional, you may want to apply field-level authorization rules to these fields. To read more: https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access.
✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema        
/ Building resource api/SplitPay⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): BranchOperatingHours: [owner], BranchPublicInfo: [owner], UserProfile: [owner], MenuItemModifier: [owner], MenuItemSize: [owner], MenuItem: [owner],  MenuGroup: [owner], Branch: [owner]. If this is not intentional, you may want to apply field-level authorization rules to these fields. To read more: https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access.
- Building resource api/SplitPay✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema        
Deployment completed.

Rolled back (2 of 1)
🛑 ["Index: 0 State: {\"deploy\":\"deploying\"} Message: Stack:arn:aws:cloudformation:eu-central-1:675795832684:stack/amplify-splitpay-staging-151233-apiSplitPay-16AD5QGQ6UTRM/158a35d0-d314-11ee-9cef-064928585b17 is in UPDATE_ROLLBACK_FAILED state and can not be updated."]

Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

Session Identifier: 1b4cc10f-fc3f-4d5c-990c-578bc81d4e2c

✅ Report saved: C:\Users\chirp\AppData\Local\Temp\SplitPay\report-1721971681919.zip

√ Done

Project Identifier: 70952c35bc147986b145b568d0636b2e

PS C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay> amplify diagnose --send-report

Learn more at https://docs.amplify.aws/cli/reference/diagnose/

✅ Report saved: C:\Users\chirp\AppData\Local\Temp\SplitPay\report-1721971734190.zip

√ Done

Project Identifier: 70952c35bc147986b145b568d0636b2e

The problem appears after the inscription "file uploading" (or something like that). And at the same time I noticed that the version of the file #current-cloud-backend.zip in the deployment bucket does not change. Maybe after I updated the file - I became its owner and the system does not have enough rights to change mine to the new one? current-cloud-backend-verions-screenshot 2024-07-26 133210

For additional information, amplify api gql-compile --allow-destructive-graphql-schema-updates works correctly:

⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): BranchOperatingHours: [owner], BranchPublicInfo: [owner], UserProfile: [owner], MenuItemModifier: [owner], MenuItemSize: [owner], MenuItem: [owner], MenuGroup: [owner], Branch: [owner]. If this is not intentional, you may want to apply field-level authorization rules to these fields. To read more: https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access.
✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema
chirpavel commented 1 month ago

uploading-files-screenshot 2024-07-26 134813

Before uploading the file, I decided to rename the file from #current-cloud-backend.zip to #current-cloud-backend-backup .zip at the moment indicated by the red arrow

But the file did not appear in the bucket, an error was displayed

Rolled back (2 of 1)
🛑 ["Index: 0 State: {\"deploy\":\"deploying\"} Message: Stack:arn:aws:cloudformation:eu-central-1:675795832684:stack/amplify-splitpay-staging-151233-apiSplitPay-16AD5QGQ6UTRM/158a35d0-d314-11ee-9cef-064928585b17 is in UPDATE_ROLLBACK_FAILED state and can not be updated."]

At the same time, it is clear that some other files have changed their version many times s3-objects-screenshot 2024-07-26 133210

github-actions[bot] commented 1 month ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.

chirpavel commented 1 month ago

The task was closed by mistake when deleting a duplicate comment. The task is very relevant!

chirpavel commented 1 month ago

Deployment activity in Amplify Studio: image

chirpavel commented 1 month ago

I tried to amplify push without #current-cloud-backend.zip (renamed to #current-cloud-backend-backup.zip):

amplify push
× There was an error pulling the backend environment staging.
🛑 The specified key does not exist.

Then I renamed to #current-cloud-backend-backup.zip to the original name: #current-cloud-backend.zip and changed the Object Ownership rules (original is yellow) edit-object-ownership-in-bucket-screenshot 2024-07-26 143029

and added permissions for S3 log delivery group s3-changed-ownership-screenshot 2024-07-26 143819

But when I run amplify push, the error after "Uploading files..." is the same:

Rolled back (2 of 1)
🛑 ["Index: 0 State: {\"deploy\":\"deploying\"} Message: Stack:arn:aws:cloudformation:eu-central-1:675795832684:stack/amplify-splitpay-staging-151233-apiSplitPay-16AD5QGQ6UTRM/158a35d0-d314-11ee-9cef-064928585b17 is in UPDATE_ROLLBACK_FAILED state and can not be updated."]
chirpavel commented 1 month ago

In the bucket there is deployment-state.json, it contains:

{
  "version": "1",
  "startedAt": "2024-07-26T06:50:22.449Z",
  "finishedAt": "2024-07-26T06:50:27.142Z",
  "status": "FAILED",
  "currentStepIndex": 0,
  "steps": [
    {
      "status": "ROLLING_BACK",
      "previousMetaKey": "amplify-appsync-files/1d69b42f50e3cfe5208ebbf987083edb0b3bf116/states/initial-stack/deployment-meta.json"
    },
    {
      "status": "WAITING_FOR_DEPLOYMENT"
    }
  ]
}

amplify-appsync-files/1d69b42f50e3cfe5208ebbf987083edb0b3bf116/states/initial-stack/deployment-meta.json in bucket contains:

{
  "stackTemplatePathOrUrl": "amplify-appsync-files/1d69b42f50e3cfe5208ebbf987083edb0b3bf116/states/initial-stack/cloudformation-template.json",
  "previousMetaKey": "amplify-appsync-files/1d69b42f50e3cfe5208ebbf987083edb0b3bf116/states/initial-stack/deployment-meta.json",
  "parameters": {
    "DynamoDBModelTableReadIOPS": "5",
    "authRoleName": "amplify-splitpay-staging-XXXXXX-authRole",
    "DynamoDBEnableServerSideEncryption": "false",
    "unauthRoleName": "amplify-splitpay-staging-XXXXXX-unauthRole",
    "DynamoDBEnablePointInTimeRecovery": "false",
    "DynamoDBBillingMode": "PAY_PER_REQUEST",
    "S3DeploymentBucket": "amplify-splitpay-staging-XXXXXX-deployment",
    "DynamoDBModelTableWriteIOPS": "5",
    "env": "staging",
    "S3DeploymentRootKey": "amplify-appsync-files/1d69b42f50e3cfe5208ebbf987083edb0b3bf116/states/initial-stack",
    "AppSyncApiName": "SplitPay",
    "AuthCognitoUserPoolId": "eu-central-1_XXXXXXXXXX"
  },
  "stackName": "arn:aws:cloudformation:eu-central-1:675795832684:stack/amplify-splitpay-staging-XXXXXX-apiSplitPay-16AD5QGQ6UTRM/158a35d0-d314-11ee-9cef-064928585b17",
  "capabilities": [
    "CAPABILITY_NAMED_IAM",
    "CAPABILITY_AUTO_EXPAND"
  ],
  "tableNames": []
}
chirpavel commented 1 month ago

Maybe new ideas?

AnilMaktala commented 1 month ago

Hey @chirpavel, Could you try rolling back the changes you made to the #current-cloud-backend.zip folder, run amplify push, and let me know the results?

chirpavel commented 1 month ago

Hey @chirpavel, Could you try rolling back the changes you made to the #current-cloud-backend.zip folder, run amplify push, and let me know the results?

Hi What do you mean roll back? Upload the file #current-cloud-backend.zip with a broken scheme? It won't work.

And I didn't find how to roll back the version of #current-cloud-backend.zip in S3. You can only download the old version and upload it again as a new file. I didn't find a direct rollback to the previous version. In any case, rolling back a version with a broken scheme does not work.

chirpavel commented 1 month ago

The internal support team says that they has identified the root cause of the issue with the CloudFormation stack and the failed update of the 'SyncSubscriptionPlanResolver' resource. The error message indicates that the resolver is not found, which is causing the update to fail.

To resolve this issue, please follow these steps:

  1. Check the resolvers directory of your GraphQL API in the project directory (amplify/backend/api//resolvers).
  2. Verify if there is a file named 'SyncSubscriptionPlanResolver' in the resolvers directory.

If the 'SyncSubscriptionPlanResolver' file does not exist in the resolvers directory, it means that the resolver is missing, and that's why the update is failing. You can create the missing resolver file manually or regenerate the resolver using the Amplify CLI.

To regenerate the resolver using the Amplify CLI, you can run the following command:

amplify update api

Follow the prompts to update the API and generate the missing resolver. Once the resolver is created, you can try updating the CloudFormation stack again to resolve the 'UPDATE_ROLLBACK_FAILED' status.

After creating or regenerating the resolver, you should be able to update the stack successfully without encountering the 'SyncSubscriptionPlanResolver' error.


I don't have rewritten resolvers, the amplify\backend\api\SplitPay\resolvers folder is empty (only README.md).

I successfully executed the amplify update api command, here is its log:

PS C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay> amplify update api
? Select from one of the below mentioned services: GraphQL

General information
- Name: SplitPay
- API endpoint: https://qoju2h4htrh3xitgusj476izcy.appsync-api.eu-central-1.amazonaws.com/graphql

Authorization modes
- Default: Amazon Cognito User Pool
- IAM

- Name: SplitPay
- API endpoint: https://qoju2h4htrh3xitgusj476izcy.appsync-api.eu-central-1.amazonaws.com/graphql

Authorization modes
- Default: Amazon Cognito User Pool
- IAM

- API endpoint: https://qoju2h4htrh3xitgusj476izcy.appsync-api.eu-central-1.amazonaws.com/graphql

Authorization modes
- Default: Amazon Cognito User Pool
- IAM

Conflict detection (required for DataStore)
- Conflict resolution strategy: Auto Merge

Authorization modes
- Default: Amazon Cognito User Pool
- IAM

Conflict detection (required for DataStore)
- Conflict resolution strategy: Auto Merge
Authorization modes
- Default: Amazon Cognito User Pool
- IAM

Conflict detection (required for DataStore)
- Conflict resolution strategy: Auto Merge
- IAM

Conflict detection (required for DataStore)
- Conflict resolution strategy: Auto Merge

Conflict detection (required for DataStore)
- Conflict resolution strategy: Auto Merge

? Select a setting to edit Authorization modes

? Select a setting to edit Authorization modes
? Select a setting to edit Authorization modes
? Choose the default authorization type for the API Amazon Cognito User Pool
? Configure additional auth types? Yes
? Choose the additional authorization types you want to configure for the API API key, IAM
API key configuration
√ Enter a description for the API key: · some api desc
√ After how many days from now the API key should expire (1-365): · 30
✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema
✅ Successfully updated resource

PS C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay> amplify codegen
√ Generated GraphQL operations successfully and saved at src\graphql

The "amplify push" was executed with exactly the same error as before:

PS C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay> amplify push -y
| Fetching updates to backend environment: staging from the cloud.✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema
√ Successfully pulled backend environment staging from the cloud.
/ Building resource api/SplitPay✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema

Current Environment: staging

┌──────────┬──────────────────────────────┬───────────┬───────────────────┐
│ Category │ Resource name │ Operation │ Provider plugin │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Api │ SplitPay │ Update │ awscloudformation │
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Auth │ SplitPay │ No Change │ awscloudformation │
...
├──────────┼──────────────────────────────┼───────────┼───────────────────┤
│ Storage │ s3splitpaystoragestaging │ No Change │ awscloudformation │
└──────────┴──────────────────────────────┴───────────┴───────────────────┘
✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema
/ Building resource api/SplitPay✅ GraphQL schema compiled successfully.

Edit your schema at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema.graphql or place .graphql files in a directory at C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay\amplify\backend\api\SplitPay\schema
Deployment completed.

Rolled back (2 of 1)
🛑 ["Index: 0 State: {\"deploy\":\"deploying\"} Message: Stack:arn:aws:cloudformation:eu-central-1:675795832684:stack/amplify-splitpay-staging-151233-apiSplitPay-16AD5QGQ6UTRM/158a35d0-d314-11ee-9cef-064928585b17 is in UPDATE_ROLLBACK_FAILED state and can not be updated."]

Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

Session Identifier: 2ad6a834-3f18-458c-bb25-4cf1525ef07d

✅ Report saved: C:\Users\chirp\AppData\Local\Temp\SplitPay\report-1722440294654.zip

√ Done

Project Identifier: 70952c35bc147986b145b568d0636b2e

I sent a report:

PS C:\Users\chirp\Downloads\SplitPay\SplitPayReact\splitpay> amplify diagnose --send-report

Learn more at https://docs.amplify.aws/cli/reference/diagnose/

✅ Report saved: C:\Users\chirp\AppData\Local\Temp\SplitPay\report-1722440359395.zip

√ Done

Project Identifier: 70952c35bc147986b145b568d0636b2e

Maybe the missing resolver needs to be added on the AppSync side? Or something needs to be created in the file: s3://amplify-splitpay-staging-151233-deployment/#current-cloud-backend.zip

The advice here in the github to change the content of schema.graphql in this file helped me. We have moved one step forward. Maybe I should change something else?

I can delete this SubscriptionPlan model and all its associated resolvers in AppSync. But how?

AnilMaktala commented 1 month ago

@chirpavel , Are you available for a screen share tomorrow?

chirpavel commented 1 month ago

@AnilMaktala yes, sure!

For now I have some screenshots around yesterday message: No overwritten resolvers: no-overwritten-resolvers-screenshot 2024-07-31 232422

The problem appears after this step: problem-after-this-step-screenshot 2024-07-31 233809

And "amplify push" error, rolled back: amplify-push-error-rolled-back-screenshot 2024-07-31 234103

AnilMaktala commented 1 month ago

Hey @chirpavel, Are you on Discord? If so, could you please share your Discord username with me?

AnilMaktala commented 3 weeks ago

Hey @chirpavel, are you still experiencing this issue?

chirpavel commented 3 weeks ago

Hey @chirpavel, are you still experiencing this issue?

Yeeess, the problem is still actual