Amplify-cli: Amplify env add gives `TypeError: Cannot read property 'provider' of undefined` error

Created on 8 Jul 2020  Â·  4Comments  Â·  Source: aws-amplify/amplify-cli

Note: If your issue/bug is regarding the AWS Amplify Console service, please log it in the
Amplify Console GitHub Issue Tracker

Describe the bug
After running Amplify env add it would give me this error, I've downgraded to version 4.22 and it does not give me the error anymore.

✖ There was an error initializing your environment.
init failed
TypeError: Cannot read property 'provider' of undefined
at Object.updateConfigOnEnvInit (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-function/src/provider-utils/awscloudformation/index.ts:310:82)
at /usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-function/src/index.ts:108:28
at /usr/local/lib/node_modules/@aws-amplify/cli/node_modules/promise-sequential/index.js:16:18
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:97:5)

Amplify CLI Version
You can use amplify -v to check the amplify cli version on your system
4.23.0

To Reproduce
Steps to reproduce the behavior or terminal output if applicable
1, npm i -g @aws-amplify/[email protected]

2, amplify env add

Expected behavior
Once you finish the command prompt input for Amplify env add, it exits and give this error:

✔ Initialized provider successfully.
? Do you want to configure Lambda Triggers for Cognito? No
? Enter the name of the group to which users will be added.
✖ There was an error initializing your environment.
init failed
TypeError: Cannot read property 'provider' of undefined
at Object.updateConfigOnEnvInit (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-function/src/provider-utils/awscloudformation/index.ts:310:82)
at /usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-function/src/index.ts:108:28
at /usr/local/lib/node_modules/@aws-amplify/cli/node_modules/promise-sequential/index.js:16:18
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:97:5)

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. Mac/Windows/Ubuntu]
  • Node Version. You can use node -v to check the node version on your system
    Mac, Nodev12.18.1

Additional context
Add any other context about the problem here.

critical-bug work-in-progress

Most helpful comment

thanks @jhockett, no longer see the error in new version

All 4 comments

Hi @ItsRLuo, this looks to be related to #4770. Can you share your amplify status?

@ItsRLuo Could you also provide the steps taken that lead up to this? Prior to running env add was there already a function added? was it already pushed?

@aws-amplify/cli version 4.23.1 has just been released. If you experience the same issue on the latest version, please comment below.

thanks @jhockett, no longer see the error in new version

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MageMasher picture MageMasher  Â·  3Comments

jeanpaulcozzatti picture jeanpaulcozzatti  Â·  3Comments

kstro21 picture kstro21  Â·  3Comments

nicksmithr picture nicksmithr  Â·  3Comments

davo301 picture davo301  Â·  3Comments