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

An error occurred during the push operation: Cannot read properties of undefined (reading 'length') #13981

Closed
2 tasks done
Paulo-Ferreira-SJ opened this issue Oct 18, 2024 · 7 comments
Labels
pending-response Issue is pending response from the issue author pending-triage Issue is pending triage platform-pull Issues related to `amplify pull`

Comments

@Paulo-Ferreira-SJ
Copy link

How did you install the Amplify CLI?

npm

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

18.17.1

Amplify CLI Version

@aws-amplify/[email protected]

What operating system are you using?

Ubuntu

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

No manual changes made

Describe the bug

I received the message: Cannot read properties of undefined (reading 'length')

Expected behavior

Deploy the amplify app

Reproduction steps

amplify push

Project Identifier

No response

Log output

# Put your logs below this line
On branch staging
Your branch is up to date with 'origin/staging'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   amplify/README.md
	modified:   amplify/backend/backend-config.json
	modified:   amplify/backend/types/amplify-dependent-resources-ref.d.ts
	modified:   amplify/cli.json
	modified:   amplify/team-provider-info.json

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	amplify/hooks/

no changes added to commit (use "git add" and/or "git commit -a")
Please note that certain attributes may not be overwritten if you choose to use defaults settings.

You have configured resources that might depend on this Cognito resource.  Updating this Cognito resource could have unintended side effects.

Using service: Cognito, provided by: awscloudformation
 What do you want to do? (Use arrow keys)
❯ Apply default configuration without Social Provider (Federation) 
  Apply default configuration with Social Provider (Federation) 
  Walkthrough all the auth configurations 
  Create or update Cognito user pool groups 
  Create or update Admin queries API 
- Fetching updates to backend environment: staging from the cloud.
- Building resource api/ApiSalesJourney
- Building resource auth/salesjourneybackendbc6d5592
- Building resource storage/salesjourney
✔ Successfully pulled backend environment staging from the cloud.
- Building resource api/ApiSalesJourney
- Building resource auth/salesjourneybackendbc6d5592
- Building resource storage/salesjourney

    Current Environment: staging
    
┌──────────┬──────────────────────────────────────────┬───────────┬───────────────────┐
│ Category │ Resource name                            │ Operation │ Provider plugin   │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Api      │ ApiSalesJourney                          │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Auth     │ salesjourneybackendbc6d5592              │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ accessHierarchies                        │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ accounts                                 │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ blockingObjects                          │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ customFields                             │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ customers                                │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ domains                                  │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ dynamicMargins                           │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ forkData                                 │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ generatePdf                              │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ governance                               │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ health                                   │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ integrations                             │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ leads                                    │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ notifications                            │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ paymentConditions                        │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ paymentMethods                           │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ plants                                   │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ pricing                                  │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ products                                 │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ public                                   │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ pushNotificationsTrigger                 │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ reports                                  │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ saleOrders                               │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ salesjourneybackendbc6d5592CustomMessage │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ scheduledEmails                          │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ squads                                   │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ stocks                                   │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ support                                  │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ users                                    │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Function │ webhooks                                 │ Update    │ awscloudformation │
├──────────┼──────────────────────────────────────────┼───────────┼───────────────────┤
│ Storage  │ salesjourney                             │ Update    │ awscloudformation │
└──────────┴──────────────────────────────────────────┴───────────┴───────────────────┘
🛑 Cannot read properties of undefined (reading 'length')

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

Session Identifier: 290b8a44-fd38-4bc0-b5ee-cdbeb1eb4c4b

Additional information

Session Identifier: 290b8a44-fd38-4bc0-b5ee-cdbeb1eb4c4b

After consulting other issues, in a similar unresolved problem, there was a suggestion to use version 14.x of Node. I tested it, and the same error occurred.

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.
@Paulo-Ferreira-SJ Paulo-Ferreira-SJ added the pending-triage Issue is pending triage label Oct 18, 2024
@ykethan
Copy link
Member

ykethan commented Oct 21, 2024

Hey @Paulo-Ferreira-SJ, could you try adding --debug to the amplify command and provide us the output on CLI?

@ykethan ykethan added pending-response Issue is pending response from the issue author platform-pull Issues related to `amplify pull` labels Oct 21, 2024
@Paulo-Ferreira-SJ
Copy link
Author

Paulo-Ferreira-SJ commented Oct 22, 2024

Hi @ykethan!
Sorry for the delay in responding; I just managed to execute it a little while ago. Here is the log running the command with --debug :

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

DeploymentFault: Cannot read properties of undefined (reading 'length')
    at Object.run (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-provider-awscloudformation/lib/push-resources.js:362:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/push-resources.js:137:16
    at async Promise.all (index 0)
    at async providersPush (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/push-resources.js:133:5)
    at async AmplifyToolkit.pushResources (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/push-resources.js:107:13)
    at async Object.executeAmplifyCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/index.js:194:9)
    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)


Cannot read properties of undefined (reading 'length')
TypeError: Cannot read properties of undefined (reading 'length')
    at /snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-provider-awscloudformation/lib/utils/consolidate-apigw-policies.js:139:83
    at Array.forEach (<anonymous>)
    at ApiGatewayAuthStack.createPoliciesFromResources (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-provider-awscloudformation/lib/utils/consolidate-apigw-policies.js:138:13)
    at /snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-provider-awscloudformation/lib/utils/consolidate-apigw-policies.js:100:16
    at Array.forEach (<anonymous>)
    at /snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-provider-awscloudformation/lib/utils/consolidate-apigw-policies.js:89:44
    at Array.forEach (<anonymous>)
    at new ApiGatewayAuthStack (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-provider-awscloudformation/lib/utils/consolidate-apigw-policies.js:72:23)
    at createApiGatewayAuthResources (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-provider-awscloudformation/lib/utils/consolidate-apigw-policies.js:217:17)
    at consolidateApiGatewayPolicies (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-provider-awscloudformation/lib/utils/consolidate-apigw-policies.js:193:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async createEnvLevelConstructs (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-provider-awscloudformation/lib/utils/env-level-constructs.js:61:95)
    at async Object.run (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-provider-awscloudformation/lib/push-resources.js:133:5)
    at async /snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/push-resources.js:137:16
    at async Promise.all (index 0)
    at async providersPush (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/push-resources.js:133:5)
    at async AmplifyToolkit.pushResources (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/push-resources.js:107:13)
    at async Object.executeAmplifyCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/index.js:194:9)
    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)

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Oct 22, 2024
@ykethan
Copy link
Member

ykethan commented Oct 22, 2024

Hey @Paulo-Ferreira-SJ, thank you for the information. From the stack trace, it appears the error occurred on a API gateway resource.

const policySizeIncrease = computePolicySizeIncrease(envName.length, method.length, apiPath.length);

From the stack trace it appears there are several updates on resources including a API resource. Could you let us know the changes made on the resource or any reproduction steps to reproduce the issue.

@ykethan ykethan added the pending-response Issue is pending response from the issue author label Oct 22, 2024
@Paulo-Ferreira-SJ
Copy link
Author

Hey @ykethan. I'm updating my AWS amplify functions Lambda from using aws-sdk v2 to v3. There are really many changes. But from the stack trace, I couldn't identify what is wrong. Could you tell me which file it is trying to read and extract these parameters from?

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Oct 22, 2024
@ykethan
Copy link
Member

ykethan commented Oct 23, 2024

Hey @Paulo-Ferreira-SJ, I would suggest running amplify update api and selecting the existing options to check if the error is mitigated.
additionally, you could try verifying the changes made in the files under amplify/api/<rest-api-name> folder.

@ykethan ykethan added the pending-response Issue is pending response from the issue author label Oct 23, 2024
@ykethan
Copy link
Member

ykethan commented Nov 12, 2024

Closing the issue due to inactivity. Do reach out to us if you are still experiencing this issue

@ykethan ykethan closed this as not planned Won't fix, can't repro, duplicate, stale Nov 12, 2024
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-response Issue is pending response from the issue author pending-triage Issue is pending triage platform-pull Issues related to `amplify pull`
Projects
None yet
Development

No branches or pull requests

2 participants