Unhelpful Error Message: Cannot read property 'length' of undefined
See original GitHub issue$ amplify push ✔ Successfully pulled backend environment dopry from the cloud. Current Environment: dopry
Category | Resource name | Operation | Provider plugin |
---|---|---|---|
… | |||
? Are you sure you want to continue? Yes | |||
✖ An error occurred when pushing the resources to the cloud |
Cannot read property ‘length’ of undefined An error occurred during the push operation: Cannot read property ‘length’ of undefined
What does this error mean? After trying all the sub-commands amplify push function shows me
Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at C:\Users\dopry\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\src\push-resources.ts:802:57
at Array.forEach (<anonymous>)
at C:\Users\dopry\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\src\push-resources.ts:786:15
at Array.forEach (<anonymous>)
at formNestedStack (C:\Users\dopry\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\src\push-resources.ts:783:14)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at Object.run (C:\Users\dopry\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\src\push-resources.ts:216:29)
at async Promise.all (index 0)
at providersPush (C:\Users\dopry\AppData\Roaming\npm\node_modules\@aws-amplify\cli\src\extensions\amplify-helpers\push-resources.ts:90:3)
at AmplifyToolkit.pushResources [as _pushResources] (C:\Users\dopry\AppData\Roaming\npm\node_modules\@aws-amplify\cli\src\extensions\amplify-helpers\push-resources.ts:66:7)
What length of what exactly? Which function resource has a problem? This error message is not helpful.
Processing each template and component should be wrapped in a try/catch and you should let developers know what is failing.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Cannot read properties of undefined (reading 'length') - TrackJS
This message indicates that our code expects to have an object with a length property, but that object was not present. length is...
Read more >TypeError: Cannot read property length from undefined
The above loc fails when I am assigning some value to 'a' and b is undefined. Error logs show me the below. by:...
Read more >Cannot read property 'length' of undefined at main (Code:204 ...
This means that in the for-loop, adGroupNegatives[adGroupIndex], is undefined for some iteration, and calling the length method on this undefined value results ...
Read more >Cannot read property 'length' of undefined when navigating to ...
TypeError : Cannot read property 'length' of undefined when navigating to the Work Items section in the project area editor in WebUI ·...
Read more >TypeError: Cannot read property 'length' of Undefined in JS
The "Cannot read property 'length' of undefined" error occurs when accessing the length property on an undefined value. To solve the error, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
not like it makes a difference since you can go straight to https://github.com/aws-amplify/amplify-cli/blob/b5f917a81524feb64ec7e674c6213cb47fd7794c/packages/amplify-provider-awscloudformation/src/push-resources.ts#L800 and see the code accessing .length on the potentially empty attributes array. lazy
but node 14/LTS and amplify 4.41.2
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.