amplify-category-api icon indicating copy to clipboard operation
amplify-category-api copied to clipboard

Amplify push failing when changing primary key

Open ChadyG opened this issue 2 years ago • 4 comments

How did you install the Amplify CLI?

homebrew

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

No response

Amplify CLI Version

12.2.4

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

Previously pushed a test table with default key to our backend. Now pushing full schema with custom primary key on the new table. Using amplify push -y --allow-destructive-graphql-schema-updates But this is failing in an odd way. The push operation starts as expected, but once the status output should start, I'm seeing the console get cleared, then no output until the operations finish with errors.

Expected behavior

Amplify push succeed or fail as normal

Reproduction steps

  1. Update schema with new table
  2. Push to backend
  3. Update new table to use a custom primary key
  4. Push to backend using --allow-destructive-graphql-schema-updates

Project Identifier

No response

Log output

% amplify push -y --allow-destructive-graphql-schema-updates
⠇ Fetching updates to backend environment: prod from the cloud.⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): .... 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: prod from the cloud.✅ GraphQL schema compiled successfully.

Edit your schema at /Users/.../schema.graphql or place .graphql files in a directory at /Users/.../schema
✔ Successfully pulled backend environment prod from the cloud.
⠦ Building resource api/appName⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): .... 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/appName✅ GraphQL schema compiled successfully.

Edit your schema at /Users/.../schema.graphql or place .graphql files in a directory at /Users/.../schema

    Current Environment: prod
    
┌──────────┬─────────────────────────────────────────────────┬───────────┬───────────────────┐
│ Category │ Resource name                                   │ Operation │ Provider plugin   │
├──────────┼─────────────────────────────────────────────────┼───────────┼───────────────────┤
│ Auth     │ userPoolGroups                                  │ Create    │ awscloudformation │
├──────────┼─────────────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ postConfirmationLambda │ Create    │ awscloudformation │
├──────────┼─────────────────────────────────────────────────┼───────────┼───────────────────┤
│ Api      │ apiBackend                                 │ Update    │ awscloudformation │
├──────────┼─────────────────────────────────────────────────┼───────────┼───────────────────┤
│ Auth     │ authBackend                 │ Update    │ awscloudformation │
├──────────┼─────────────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ statsSharedLambda                      │ Update    │ awscloudformation │
├──────────┼─────────────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ removeUserAccountAndData                        │ Update    │ awscloudformation │
├──────────┼─────────────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ shotsbycategory                                 │ Update    │ awscloudformation │
├──────────┼─────────────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ userExists                                      │ Update    │ awscloudformation │
├──────────┼─────────────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ clubaverages                                    │ No Change │ awscloudformation │
├──────────┼─────────────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ fetchShadow                                     │ No Change │ awscloudformation │
├──────────┼─────────────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ productRegistrationReport                       │ No Change │ awscloudformation │
├──────────┼─────────────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ sessionsinrange                                 │ No Change │ awscloudformation │
├──────────┼─────────────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ sessionstats                                    │ No Change │ awscloudformation │
├──────────┼─────────────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ shotsbyclub                                     │ No Change │ awscloudformation │
├──────────┼─────────────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ shotsinrange                                    │ No Change │ awscloudformation │
├──────────┼─────────────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ userstats                                       │ No Change │ awscloudformation │
├──────────┼─────────────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ writeShadow                                     │ No Change │ awscloudformation │
├──────────┼─────────────────────────────────────────────────┼───────────┼───────────────────┤
│ Storage  │ appStorage                          │ No Change │ awscloudformation │
└──────────┴─────────────────────────────────────────────────┴───────────┴───────────────────┘
⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): .... 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 /Users/.../schema.graphql or place .graphql files in a directory at /Users/.../schema

Suggested configuration for new layer versions:

statsSharedLambda
  - Access permissions: Maintain existing permissions
  - Description: Updated layer version  2023-08-10T13:39:55.315Z

⠧ Building resource api/appName⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): [...]. 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/appName✅ GraphQL schema compiled successfully.

Edit your schema at /Users/.../schema.graphql or place .graphql files in a directory at /Users/.../schema




































































































































































































































































































































Deployment completed.

Rolled back (2 of 1)
🛑 ["Index: 0 State: {\"deploy\":\"waitingForDeployment\"} Message: Resource is not in the state stackUpdateComplete"]

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

Additional information

Worked around by dropping the table entirely from the schema, pushing with destructive changes. Then re-adding the table and pushing as normal.

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.

ChadyG avatar Aug 10 '23 14:08 ChadyG