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]: [31mFailed to pull the backend.[39m
2021-11-26T03:23:44.389Z [INFO]: [31mCannot find module 'provider-utils/awscloudformation/index'[39m
[31mRequire stack:[39m
[31m- /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-api/lib/index.js[39m
[31m- /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-container-hosting/lib/ElasticContainer/index.js[39m
[31m- /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-container-hosting/index.js[39m
[31m- /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/lib/extensions/amplify-helpers/on-category-outputs-change.js[39m
[31m- /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/lib/domain/amplify-toolkit.js[39m
[31m- /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/lib/domain/context.js[39m
[31m- /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/lib/context-manager.js[39m
[31m- /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/lib/index.js[39m
[31m- /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/bin/amplify[39m
2021-11-26T03:23:44.390Z [INFO]: [0m/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-api/lib/index.js:1[0m
[0mError: Cannot find module 'provider-utils/awscloudformation/index'[0m
[0mRequire stack:[0m
[0m- /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-api/lib/index.js[0m
[0m- /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-container-hosting/lib/ElasticContainer/index.js[0m
[0m- /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-container-hosting/index.js[0m
[0m- /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/lib/extensions/amplify-helpers/on-category-outputs-change.js[0m
[0m- /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/lib/domain/amplify-toolkit.js[0m
[0m- /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/lib/domain/context.js[0m
[0m- /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/lib/context-manager.js[0m
[0m- /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/lib/index.js[0m
[0m- /root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/bin/amplify[0m
[0m 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[0m
[0m at runMicrotasks (<anonymous>)[0m
[0m at processTicksAndRejections (internal/process/task_queues.js:97:5)[0m
[0m 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)[0m
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
- Amplify pull
- Or deploy changes out to Git and have Amplify Console pull the changes.
- 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)
@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.