Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amplify push failing when changing primary key #1797

Open
2 tasks done
ChadyG opened this issue Aug 10, 2023 · 4 comments
Open
2 tasks done

Amplify push failing when changing primary key #1797

ChadyG opened this issue Aug 10, 2023 · 4 comments
Assignees
Labels

Comments

@ChadyG
Copy link

ChadyG commented Aug 10, 2023

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:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.
@josefaidt
Copy link
Contributor

Hey @ChadyG 👋 thanks for raising this! I was able to reproduce this using the following steps:

  1. amplify init -y
  2. amplify add api > GraphQL > choose the "Todo" sample schema
  3. amplify push -y
  4. add @primaryKey to the name prop
    type Todo @model {
      id: ID!
      name: String! @primaryKey
      description: String
    }
  5. amplify push -y
  6. observe error
, review: https://docs.amplify.aws/cli/graphql/authorization-rules

⠋ Building resource api/13100✅ GraphQL schema compiled successfully.

Edit your schema at /Users/josefai/Documents/projects/aws-amplify/reproductions/13100/amplify/backend/api/13100/schema.graphql or place .graphql files in a directory at /Users/josefai/Documents/projects/aws-amplify/reproductions/13100/amplify/backend/api/13100/schema

Deployment completed.
Deploying api 13100 [ ====------------------------------------ ] 1/9
        GraphQLAPITransformerSchema3C… AWS::AppSync::GraphQLSchema    UPDATE_COMPLE

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

Marking as a bug and transferring to our API repo for tracking purposes.

@josefaidt josefaidt transferred this issue from aws-amplify/amplify-cli Aug 10, 2023
@josefaidt josefaidt added bug Something isn't working transferred @primaryKey and removed pending-triage labels Aug 10, 2023
@AnilMaktala AnilMaktala added the p2 label Aug 14, 2023
@codenimble
Copy link

codenimble commented Jan 27, 2024

I am also getting this error. I've been going around and around on this for days. Amplify is simply unusable.

@sundersc sundersc self-assigned this Feb 20, 2024
@mtrexsh
Copy link

mtrexsh commented Jan 28, 2025

Hi. Any updates on this issue. We also had this error and trying to find some solution.

@francotechadmin
Copy link

Also ran into this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants