amplify-cli: DEPLOY FAILING! Error: Cannot find module 'provider-utils/awscloudformation/index' after update to Amplify 7.5.2

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?

v10.23.2

Amplify CLI Version

7.5.2

What operating system are you using?

Amazon Linux, Cloud9

Amplify Categories

Not applicable

Amplify Commands

pull, push

Describe the bug

I am unable to do any deployments via a push or a pull after upgrading my amplify to the latest 7.5.2.

When I run amplify pull on my Amazon Linux Cloud9, I get the following error:

Error: Cannot find module 'provider-utils/awscloudformation/index'
Require stack:
- /home/ec2-user/.nvm/versions/node/v10.23.2/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-api/lib/index.js
- /home/ec2-user/.nvm/versions/node/v10.23.2/lib/node_modules/@aws-amplify/cli/lib/initialize-env.js
- /home/ec2-user/.nvm/versions/node/v10.23.2/lib/node_modules/@aws-amplify/cli/lib/pull-backend.js
- /home/ec2-user/.nvm/versions/node/v10.23.2/lib/node_modules/@aws-amplify/cli/lib/commands/pull.js
- /home/ec2-user/.nvm/versions/node/v10.23.2/lib/node_modules/@aws-amplify/cli/lib/index.js
- /home/ec2-user/.nvm/versions/node/v10.23.2/lib/node_modules/@aws-amplify/cli/bin/amplify
    at Promise.resolve.then (/home/ec2-user/.nvm/versions/node/v10.23.2/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-api/lib/index.js:128:80)
    at process._tickCallback (internal/process/next_tick.js:68:7)

When I try to deploy to AWS Amplify console, this is the error I get:

2021-11-26T03:23:41.247Z [WARNING]: ✖ There was an error initializing your environment.
2021-11-26T03:23:44.384Z [INFO]: Failed to pull the backend.
2021-11-26T03:23:44.389Z [INFO]: Cannot find module 'provider-utils/awscloudformation/index'
                                 Require stack:
                                 - /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-api/lib/index.js
                                 - /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-container-hosting/lib/ElasticContainer/index.js
                                 - /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-container-hosting/index.js
                                 - /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/lib/extensions/amplify-helpers/on-category-outputs-change.js
                                 - /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/lib/domain/amplify-toolkit.js
                                 - /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/lib/domain/context.js
                                 - /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/lib/context-manager.js
                                 - /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/lib/index.js
                                 - /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/bin/amplify
2021-11-26T03:23:44.390Z [INFO]: /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-api/lib/index.js:1
                                 Error: Cannot find module 'provider-utils/awscloudformation/index'
                                 Require stack:
                                 - /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-api/lib/index.js
                                 - /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-container-hosting/lib/ElasticContainer/index.js
                                 - /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-container-hosting/index.js
                                 - /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/lib/extensions/amplify-helpers/on-category-outputs-change.js
                                 - /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/lib/domain/amplify-toolkit.js
                                 - /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/lib/domain/context.js
                                 - /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/lib/context-manager.js
                                 - /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/lib/index.js
                                 - /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/bin/amplify
                                     at /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-api/src/index.ts:128:30
                                     at runMicrotasks (<anonymous>)
                                     at processTicksAndRejections (internal/process/task_queues.js:97:5)
                                     at initEnv (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-api/src/index.ts:128:30)
2021-11-26T03:23:44.444Z [ERROR]: !!! Build failed
2021-11-26T03:23:44.444Z [ERROR]: !!! Non-Zero Exit Code detected

All of this is happening after upgrading amplify CLI to the latest 7.5.2.

Can you please advise?

Expected behavior

The expected result should be a successful pull from the backend to my local machine.

Reproduction steps

  1. Amplify pull
  2. Or deploy changes out to Git and have Amplify Console pull the changes.
  3. The same error applies on the latest 7.5.2 version of the amplify CLI.

GraphQL schema(s)

# Put schemas below this line


Log output

# Put your logs below this line


Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (4 by maintainers)

Most upvoted comments

@kishan2110 are you using the packaged version of the CLI (typically installed via curl)?

I ask because the message accompanying your stack trace implies that the import path is not handled during the packaging process. Looking at amplify-category-api/src/index.ts, there are a few dynamic imports like this which access the problematic path.

Thanks for verifying @kishan2110. I’ll link the PR to this issue so that it auto closes when the PR is merged.