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

methods.forEach is not a function error on amplify push since 4.50.0 #7301

Closed
4 tasks done
dsinyakov opened this issue May 11, 2021 · 3 comments · Fixed by #7305
Closed
4 tasks done

methods.forEach is not a function error on amplify push since 4.50.0 #7301

dsinyakov opened this issue May 11, 2021 · 3 comments · Fixed by #7305
Assignees
Labels
api-rest Issues tied to REST APIs bug Something isn't working

Comments

@dsinyakov
Copy link

Before opening, please confirm:

  • I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
  • I have searched for duplicate or closed issues.
  • I have read the guide for submitting bug reports.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

How did you install the Amplify CLI?

npm

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

v13.2.0

Amplify CLI Version

4.50.2

What operating system are you using?

Mac OS

Amplify Categories

auth, function, api, hosting

Amplify Commands

push

Describe the bug

Getting methods.forEach is not a function error on amplify push since couple days (maybe week(s)).

Could be related to fix delivered as part of 4.50.0 release.
Specifically

Since policy management has now changed, my templates probably missing data.

Current Environment: dev

Category Resource name Operation Provider plugin
Api api1 Update awscloudformation
Hosting S3AndCloudFront No Change awscloudformation
Auth auth1 No Change awscloudformation
Api api2 No Change awscloudformation
Api api3 No Change awscloudformation
... ... ... ..
Function function1 No Change awscloudformation
Function funciton2 No Change awscloudformation
? Are you sure you want to continue? Yes
✖ An error occurred when pushing the resources to the cloud

methods.forEach is not a function
An error occurred during the push operation: methods.forEach is not a function

Expected behavior

  1. No breakage occurs when amplify CLI upgrades
  2. amplify push goes through

Reproduction steps

  1. Current version 4.44.0
  2. can still push with not issues via command line, but deployment fails if pushed to code commit repo and run via AWS Amplify infra.
  3. Upgrade to 4.50.0 (or later)
  4. run amplify push returns error `methods.forEach is not a function

GraphQL schema(s)

# Put schemas below this line

Log output


From console log:

2021-05-08T20:48:09.315Z [INFO]: �[0mTypeError: methods.forEach is not a function�[0m
                                 �[0m    at ApiGatewayAuthStack.createPoliciesFromResources (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/src/utils/consolidate-apigw-policies.ts:120:13)�[0m
                                 �[0m    at /usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/src/utils/consolidate-apigw-policies.ts:94:16�[0m
                                 �[0m    at Array.forEach (<anonymous>)�[0m
                                 �[0m    at /usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/src/utils/consolidate-apigw-policies.ts:84:31�[0m
                                 �[0m    at Array.forEach (<anonymous>)�[0m
                                 �[0m    at new ApiGatewayAuthStack (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/src/utils/consolidate-apigw-policies.ts:62:23)�[0m
                                 �[0m    at createApiGatewayAuthResources (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/src/utils/consolidate-apigw-policies.ts:201:17)�[0m
                                 �[0m    at Object.consolidateApiGatewayPolicies (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/src/utils/consolidate-apigw-policies.ts:197:10)�[0m
                                 �[0m    at Object.createEnvLevelConstructs (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/src/utils/env-level-constructs.ts:22:5)�[0m
                                 �[0m    at runMicrotasks (<anonymous>)�[0m
                                 �[0m    at processTicksAndRejections (internal/process/task_queues.js:97:5)�[0m
                                 �[0m    at Object.run (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/src/push-resources.ts:97:5)�[0m



Additional information

No response

@cjihrig
Copy link
Contributor

cjihrig commented May 11, 2021

Thank you for reporting this.

As you mentioned, there was a change in v4.50.0. The CLI now uses your API's api-params.json file to generate IAM policies. Would you mind sending that file to amplify-cli@amazon.com and referencing this issue?

@dsinyakov
Copy link
Author

@cjihrig thanks for prompt reply.
Sent multiple api-params.json files.

@cjihrig cjihrig self-assigned this May 11, 2021
@cjihrig cjihrig added api-rest Issues tied to REST APIs bug Something isn't working labels May 11, 2021
@cjihrig cjihrig linked a pull request May 11, 2021 that will close this issue
2 tasks
@github-actions
Copy link

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-rest Issues tied to REST APIs bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants