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

Error triggered on amplify push/pull after deleting then adding new fields to a custom Graphql type #13660

Closed
2 tasks done
MattWlodarski opened this issue Mar 19, 2024 · 2 comments
Labels
pending-triage Issue is pending triage

Comments

@MattWlodarski
Copy link

How did you install the Amplify CLI?

npm

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

v20

Amplify CLI Version

12.10.1

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

I ran a successful amplify push request for our graphql API. In this request, the only thing we changed was removing two String array fields from a custom type and adding some new fields to the same custom type. This type is not a model - it's being referenced in a model. After the successful push, whenever we try to perform another push command we get the following error:

PushResourcesFault: Cannot read properties of undefined (reading 'map')
at AmplifyToolkit.pushResources (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/push-resources.js:116:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.executeAmplifyCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-function/lib/index.js:277:5)
at async executePluginModuleCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:139:5)
at async executeCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:37:9)
at async Object.run (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/index.js:121:5)

I'm assuming that the system still thinks the original two string array fields still exist but it can't find them so it throws this map error. I've tried running an amplify pull but I get a very similar error. So, at this point I'm stuck and can't update or pull my API at all.

Expected behavior

Amplify push command should run successfully without the aforementioned error.

Reproduction steps

  1. Create a model and a custom type. Reference the custom type in your model.
  2. Make sure the custom type has a string array field then push your changes
  3. After pushing your changes, remove the string array field from your custom type and add some other fields
  4. Push your changes again
  5. Afterwards, future push attempts will fail due to the bug I mentioned above.

Project Identifier

No response

Log output

# Put your logs below this line


Additional information

No response

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.
@MattWlodarski MattWlodarski added the pending-triage Issue is pending triage label Mar 19, 2024
@MattWlodarski
Copy link
Author

Apparently I was missing:
"providers": [
"awscloudformation"
],

in my project-config.json file. I've never had this in there before (this is an old project) so I'm not sure why it triggered the error now.

Copy link

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.

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

No branches or pull requests

1 participant