aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.81k stars 821 forks source link

Unable to upgrade Node AND Amplify prior to `amplifyPush` in build in Amplify Console CI/CD #9021

Closed chrismilleruk closed 2 years ago

chrismilleruk commented 2 years ago

Before opening, please confirm:

How did you install the Amplify CLI?

npm & yarn

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

node 16

Amplify CLI Version

7.3.3 - 7.3.5

What operating system are you using?

Amazon Linux

Amplify Categories

Not applicable

Amplify Commands

push, Not applicable

Describe the bug

In order to support typescript compilation in lambda functions (https://docs.amplify.aws/cli/function/build-options/) I need to upgrade node & npm prior to amplifyPush --simple (which has a dependency on @aws-amplify/cli).

Most folks seem to do node upgrades in the frontEnd-preBuild via nvm and while this destroys amplify cli, this goes unnoticed since the backEnd-build has already taken place.

I tried a few different methods to get this working (below) but the simplest repro steps below (nvm install 16, yarn global add @aws-amplify/cli create the following error:

2021-11-17T02:42:03.185Z [INFO]: success Installed "@aws-amplify/cli@7.3.5" with binaries:
2021-11-17T02:42:03.186Z [INFO]: - amplify
2021-11-17T02:42:03.186Z [INFO]: Done in 50.80s.
2021-11-17T02:42:03.222Z [INFO]: # Executing command: amplify --version
2021-11-17T02:42:08.754Z [INFO]: The following official plugins are missing or inactive:
2021-11-17T02:42:08.756Z [INFO]: awscloudformation: provider | amplify-provider-awscloudformation@5.3.3
                                 analytics: category | amplify-category-analytics@3.2.1
                                 api: category | amplify-category-api@3.3.0
                                 function: category | amplify-category-function@3.3.0
                                 geo: category | amplify-category-geo@2.2.1
                                 hosting: category | amplify-category-hosting@3.2.1
                                 hosting: category | amplify-console-hosting@2.2.1
                                 hosting: category | amplify-container-hosting@2.3.0
                                 interactions: category | amplify-category-interactions@3.2.1
                                 notifications: category | amplify-category-notifications@2.19.4
                                 predictions: category | amplify-category-predictions@3.2.1
                                 xr: category | amplify-category-xr@3.2.1
                                 codegen: util | amplify-codegen@^2.23.1
                                 flutter: frontend | amplify-frontend-flutter@1.3.0
                                 android: frontend | amplify-frontend-android@3.3.0
                                 ios: frontend | amplify-frontend-ios@3.3.0
                                 javascript: frontend | amplify-frontend-javascript@3.3.0
                                 mock: util | amplify-util-mock@4.2.4
2021-11-17T02:42:08.815Z [INFO]: 7.3.5
2021-11-17T02:42:09.170Z [INFO]: # Completed phase: preBuild

Other techniques attempted

Side note. I had managed to workaround this issue previously by upgrading both npm and @aws-amplify/cli in _LIVE_UPDATES, which was just enough at the time, but that stopped working last week. I suspect the root cause of failure was a change (Tue 16th between 12:00 and 18:00 GMT) to run the npm live updates in parallel instead of in the supplied order. it's obviously not possible to upgrade npm while npm is installing something else so my hack failed. Regardless, the Cloning Repository step was marked as successful even though it failed with errors.

Expected behavior

It should be possible to upgrade node using nvm and install @aws-amplify/cli@latest prior to amplifyPush

Reproduction steps


version: 1
backend:
  phases:
    preBuild:
      commands:
        - "# Check Versions"
        - node --version
        - npm --version
        - yarn --version
        - which amplify
        - amplify --version
        - nvm install 16
        # - nvm install 16 --reinstall-packages-from=node
        # - nvm use 16
        # - npm install -g @aws-amplify/cli@latest
        - yarn global add @aws-amplify/cli
        - amplify --version
    build:
      commands:
        - "# Execute Amplify CLI with the helper script"
        - amplifyPush --simple
 ...

GraphQL schema(s)

```graphql # Put schemas below this line n/a ```

Log output

``` # Put your logs below this line # Starting phase: preBuild # Executing command: node --version 2021-11-17T02:41:04.169Z [INFO]: v12.21.0 2021-11-17T02:41:04.170Z [INFO]: # Executing command: npm --version 2021-11-17T02:41:04.285Z [INFO]: 6.14.11 2021-11-17T02:41:04.288Z [INFO]: # Executing command: yarn --version 2021-11-17T02:41:04.938Z [INFO]: 1.22.0 2021-11-17T02:41:04.944Z [INFO]: # Executing command: which amplify 2021-11-17T02:41:04.945Z [INFO]: /root/.nvm/versions/node/v12.21.0/bin/amplify 2021-11-17T02:41:04.945Z [INFO]: # Executing command: amplify --version 2021-11-17T02:41:09.393Z [INFO]: 7.3.5 2021-11-17T02:41:09.734Z [INFO]: # Executing command: nvm install 16 2021-11-17T02:41:10.143Z [INFO]: Downloading and installing node v16.13.0... 2021-11-17T02:41:10.337Z [WARNING]: Downloading https://nodejs.org/dist/v16.13.0/node-v16.13.0-linux-x64.tar.gz... 2021-11-17T02:41:10.459Z [WARNING]: 2021-11-17T02:41:10.459Z [WARNING]: 0.5% 2021-11-17T02:41:10.561Z [WARNING]: ###### 2021-11-17T02:41:10.562Z [WARNING]: 8.8% 2021-11-17T02:41:10.662Z [WARNING]: ############################## 2021-11-17T02:41:10.663Z [WARNING]: ##### 48.9% 2021-11-17T02:41:10.763Z [WARNING]: #################################### 2021-11-17T02:41:10.763Z [WARNING]: ################################ 95.8% 2021-11-17T02:41:10.768Z [WARNING]: #################### 2021-11-17T02:41:10.768Z [WARNING]: #################################################### 100.0% 2021-11-17T02:41:10.783Z [WARNING]: Computing checksum with sha256sum 2021-11-17T02:41:10.891Z [WARNING]: Checksums matched! 2021-11-17T02:41:12.125Z [INFO]: Now using node v16.13.0 (npm v8.1.0) 2021-11-17T02:41:12.154Z [INFO]: # Executing command: yarn global add @aws-amplify/cli 2021-11-17T02:41:12.388Z [INFO]: yarn global v1.22.0 2021-11-17T02:41:12.429Z [INFO]: [1/4] Resolving packages... 2021-11-17T02:41:18.158Z [WARNING]: warning @aws-amplify/cli > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. 2021-11-17T02:41:18.161Z [WARNING]: warning @aws-amplify/cli > amplify-category-analytics > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. warning @aws-amplify/cli > amplify-category-function > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. warning @aws-amplify/cli > amplify-category-api > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. warning @aws-amplify/cli > amplify-category-predictions > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. warning @aws-amplify/cli > amplify-category-interactions > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. warning @aws-amplify/cli > @aws-amplify/amplify-category-auth > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. warning @aws-amplify/cli > aws-sdk > uuid@3.3.2: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. 2021-11-17T02:41:18.292Z [WARNING]: warning @aws-amplify/cli > amplify-app > xcode > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. 2021-11-17T02:41:21.018Z [WARNING]: warning @aws-amplify/cli > aws-sdk > querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. 2021-11-17T02:41:21.025Z [WARNING]: warning @aws-amplify/cli > aws-sdk > url > querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. 2021-11-17T02:41:21.742Z [WARNING]: warning @aws-amplify/cli > amplify-util-mock > amplify-storage-simulator > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. 2021-11-17T02:41:21.755Z [WARNING]: warning @aws-amplify/cli > amplify-util-mock > amplify-appsync-simulator > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. 2021-11-17T02:41:22.520Z [WARNING]: warning @aws-amplify/cli > amplify-codegen > @graphql-codegen/core > @graphql-toolkit/common@0.6.6: GraphQL Toolkit is deprecated and merged into GraphQL Tools, so it will no longer get updates. Use GraphQL Tools instead to stay up-to-date! Check out https://www.graphql-tools.com/docs/migration-from-toolkit for migration and https://the-guild.dev/blog/graphql-tools-v6 for new changes. warning @aws-amplify/cli > amplify-codegen > @graphql-codegen/core > @graphql-codegen/plugin-helpers > @graphql-toolkit/common@0.6.6: GraphQL Toolkit is deprecated and merged into GraphQL Tools, so it will no longer get updates. Use GraphQL Tools instead to stay up-to-date! Check out https://www.graphql-tools.com/docs/migration-from-toolkit for migration and https://the-guild.dev/blog/graphql-tools-v6 for new changes. 2021-11-17T02:41:22.520Z [WARNING]: warning @aws-amplify/cli > amplify-codegen > @graphql-codegen/core > @graphql-toolkit/schema-merging > @graphql-toolkit/common@0.6.6: GraphQL Toolkit is deprecated and merged into GraphQL Tools, so it will no longer get updates. Use GraphQL Tools instead to stay up-to-date! Check out https://www.graphql-tools.com/docs/migration-from-toolkit for migration and https://the-guild.dev/blog/graphql-tools-v6 for new changes. warning @aws-amplify/cli > amplify-codegen > amplify-codegen-appsync-model-plugin > @graphql-codegen/visitor-plugin-common > @graphql-codegen/plugin-helpers > @graphql-toolkit/common@0.9.7: GraphQL Toolkit is deprecated and merged into GraphQL Tools, so it will no longer get updates. Use GraphQL Tools instead to stay up-to-date! Check out https://www.graphql-tools.com/docs/migration-from-toolkit for migration and https://the-guild.dev/blog/graphql-tools-v6 for new changes. 2021-11-17T02:41:22.580Z [WARNING]: warning @aws-amplify/cli > amplify-provider-awscloudformation > cfn-lint > core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js. 2021-11-17T02:41:22.601Z [WARNING]: warning @aws-amplify/cli > amplify-codegen > graphql-config > graphql-import@0.7.1: GraphQL Import has been deprecated and merged into GraphQL Tools, so it will no longer get updates. Use GraphQL Tools instead to stay up-to-date! Check out https://www.graphql-tools.com/docs/migration-from-import for migration and https://the-guild.dev/blog/graphql-tools-v6 for new changes. 2021-11-17T02:41:22.863Z [WARNING]: warning @aws-amplify/cli > amplify-util-mock > amplify-dynamodb-simulator > event-to-promise@0.8.0: Use promise-toolbox/fromEvent instead 2021-11-17T02:41:22.864Z [WARNING]: warning @aws-amplify/cli > amplify-util-mock > amplify-storage-simulator > event-to-promise@0.8.0: Use promise-toolbox/fromEvent instead warning @aws-amplify/cli > amplify-util-mock > amplify-appsync-simulator > event-to-promise@0.8.0: Use promise-toolbox/fromEvent instead 2021-11-17T02:41:22.985Z [WARNING]: warning @aws-amplify/cli > amplify-util-mock > amplify-appsync-simulator > graphql-tools@4.0.8: This package has been deprecated and now it only exports makeExecutableSchema.\nAnd it will no longer receive updates.\nWe recommend you to migrate to scoped packages such as @graphql-tools/schema, @graphql-tools/utils and etc.\nCheck out https://www.graphql-tools.com to learn what package you should use instead 2021-11-17T02:41:22.986Z [WARNING]: warning @aws-amplify/cli > amplify-util-mock > amplify-appsync-simulator > graphql-tools > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. 2021-11-17T02:41:23.405Z [WARNING]: warning @aws-amplify/cli > amplify-codegen > amplify-graphql-types-generator > babel-types > babel-runtime > core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js. 2021-11-17T02:41:23.409Z [WARNING]: warning @aws-amplify/cli > amplify-codegen > @graphql-codegen/core > @graphql-toolkit/schema-merging > @kamilkisiela/graphql-tools > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. 2021-11-17T02:41:23.532Z [WARNING]: warning @aws-amplify/cli > amplify-codegen > amplify-codegen-appsync-model-plugin > @graphql-codegen/visitor-plugin-common > @graphql-toolkit/relay-operation-optimizer > @graphql-toolkit/common@0.9.7: GraphQL Toolkit is deprecated and merged into GraphQL Tools, so it will no longer get updates. Use GraphQL Tools instead to stay up-to-date! Check out https://www.graphql-tools.com/docs/migration-from-toolkit for migration and https://the-guild.dev/blog/graphql-tools-v6 for new changes. 2021-11-17T02:41:23.539Z [WARNING]: warning @aws-amplify/cli > amplify-codegen > amplify-codegen-appsync-model-plugin > @graphql-codegen/visitor-plugin-common > @graphql-codegen/plugin-helpers > @graphql-toolkit/common > @ardatan/graphql-tools > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. 2021-11-17T02:41:24.215Z [WARNING]: warning @aws-amplify/cli > amplify-codegen > amplify-codegen-appsync-model-plugin > @graphql-codegen/visitor-plugin-common > @graphql-toolkit/relay-operation-optimizer > relay-compiler > fbjs > core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js. 2021-11-17T02:41:24.600Z [WARNING]: warning @aws-amplify/cli > amplify-codegen > amplify-codegen-appsync-model-plugin > @graphql-codegen/visitor-plugin-common > @graphql-toolkit/relay-operation-optimizer > relay-compiler > fast-glob > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated 2021-11-17T02:41:24.616Z [WARNING]: warning @aws-amplify/cli > amplify-codegen > amplify-codegen-appsync-model-plugin > @graphql-codegen/visitor-plugin-common > @graphql-toolkit/relay-operation-optimizer > relay-compiler > fast-glob > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated 2021-11-17T02:41:24.736Z [INFO]: [2/4] Fetching packages... 2021-11-17T02:41:42.199Z [WARNING]: warning amplify-app@4.2.1: The engine "@aws-amplify/cli" appears to be invalid. 2021-11-17T02:41:42.203Z [INFO]: info fsevents@2.3.2: The platform "linux" is incompatible with this module. 2021-11-17T02:41:42.204Z [INFO]: info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation. 2021-11-17T02:41:42.208Z [INFO]: [3/4] Linking dependencies... 2021-11-17T02:41:42.209Z [WARNING]: warning "@aws-amplify/cli > amplify-codegen@2.26.15" has incorrect peer dependency "amplify-cli-core@^1.17.2". 2021-11-17T02:41:42.210Z [WARNING]: warning "@aws-amplify/cli > amplify-codegen@2.26.15" has incorrect peer dependency "graphql-transformer-core@^6.26.2". 2021-11-17T02:41:42.212Z [WARNING]: warning "@aws-amplify/cli > amplify-category-api > @aws-cdk/aws-codebuild@1.124.0" has unmet peer dependency "@aws-cdk/aws-codecommit@1.124.0". 2021-11-17T02:41:42.212Z [WARNING]: warning "@aws-amplify/cli > amplify-category-api > @aws-cdk/aws-codebuild@1.124.0" has unmet peer dependency "@aws-cdk/aws-codestarnotifications@1.124.0". 2021-11-17T02:41:42.212Z [WARNING]: warning "@aws-amplify/cli > amplify-category-api > @aws-cdk/aws-codepipeline@1.124.0" has unmet peer dependency "@aws-cdk/aws-codestarnotifications@1.124.0". 2021-11-17T02:41:42.213Z [WARNING]: warning "@aws-amplify/cli > amplify-category-api > @aws-cdk/aws-codepipeline-actions@1.124.0" has unmet peer dependency "@aws-cdk/aws-codecommit@1.124.0". 2021-11-17T02:41:42.214Z [WARNING]: warning "@aws-amplify/cli > amplify-category-api > @aws-cdk/aws-codepipeline-actions@1.124.0" has unmet peer dependency "@aws-cdk/aws-codedeploy@1.124.0". 2021-11-17T02:41:42.214Z [WARNING]: warning "@aws-amplify/cli > amplify-category-api > @aws-cdk/aws-codepipeline-actions@1.124.0" has unmet peer dependency "@aws-cdk/aws-events-targets@1.124.0". 2021-11-17T02:41:42.214Z [WARNING]: warning "@aws-amplify/cli > amplify-category-api > @aws-cdk/aws-codepipeline-actions@1.124.0" has unmet peer dependency "@aws-cdk/aws-stepfunctions@1.124.0". 2021-11-17T02:41:42.215Z [WARNING]: warning "@aws-amplify/cli > amplify-category-api > @aws-cdk/aws-route53-targets@1.124.0" has unmet peer dependency "@aws-cdk/aws-globalaccelerator@1.124.0". 2021-11-17T02:41:42.217Z [WARNING]: warning "@aws-amplify/cli > amplify-category-api > @aws-cdk/aws-sns@1.124.0" has unmet peer dependency "@aws-cdk/aws-codestarnotifications@1.124.0". 2021-11-17T02:41:42.218Z [WARNING]: warning "@aws-amplify/cli > amplify-category-api > @aws-cdk/aws-lambda@1.124.0" has unmet peer dependency "@aws-cdk/aws-signer@1.124.0". 2021-11-17T02:41:42.219Z [WARNING]: warning "@aws-amplify/cli > amplify-provider-awscloudformation > @aws-cdk/aws-batch@1.124.0" has unmet peer dependency "@aws-cdk/aws-ssm@1.124.0". 2021-11-17T02:41:42.220Z [WARNING]: warning "@aws-amplify/cli > amplify-provider-awscloudformation > @aws-cdk/aws-events-targets@1.124.0" has unmet peer dependency "@aws-cdk/aws-apigateway@1.124.0". 2021-11-17T02:41:42.220Z [WARNING]: warning "@aws-amplify/cli > amplify-provider-awscloudformation > @aws-cdk/aws-codecommit@1.124.0" has unmet peer dependency "@aws-cdk/aws-codestarnotifications@1.124.0". 2021-11-17T02:41:42.222Z [WARNING]: warning "@aws-amplify/cli > @aws-amplify/amplify-category-storage > @aws-cdk/aws-dynamodb@1.124.0" has unmet peer dependency "@aws-cdk/aws-applicationautoscaling@1.124.0". 2021-11-17T02:41:42.222Z [WARNING]: warning "@aws-amplify/cli > @aws-amplify/amplify-category-storage > @aws-cdk/aws-dynamodb@1.124.0" has unmet peer dependency "@aws-cdk/aws-cloudwatch@1.124.0". warning "@aws-amplify/cli > @aws-amplify/amplify-category-storage > @aws-cdk/aws-dynamodb@1.124.0" has unmet peer dependency "@aws-cdk/aws-iam@1.124.0". warning "@aws-amplify/cli > @aws-amplify/amplify-category-storage > @aws-cdk/aws-dynamodb@1.124.0" has unmet peer dependency "@aws-cdk/aws-kinesis@1.124.0". warning "@aws-amplify/cli > @aws-amplify/amplify-category-storage > @aws-cdk/aws-dynamodb@1.124.0" has unmet peer dependency "@aws-cdk/aws-kms@1.124.0". warning "@aws-amplify/cli > @aws-amplify/amplify-category-storage > @aws-cdk/aws-dynamodb@1.124.0" has unmet peer dependency "@aws-cdk/aws-lambda@1.124.0". warning "@aws-amplify/cli > @aws-amplify/amplify-category-storage > @aws-cdk/aws-dynamodb@1.124.0" has unmet peer dependency "@aws-cdk/custom-resources@1.124.0". warning "@aws-amplify/cli > @aws-amplify/amplify-category-storage > @aws-cdk/aws-dynamodb@1.124.0" has unmet peer dependency "constructs@^3.3.69". 2021-11-17T02:41:42.227Z [WARNING]: warning "@aws-amplify/cli > amplify-provider-awscloudformation > @aws-amplify/graphql-transformer-interfaces > @aws-cdk/aws-elasticsearch@1.124.0" has unmet peer dependency "@aws-cdk/aws-certificatemanager@1.124.0". 2021-11-17T02:41:42.227Z [WARNING]: warning "@aws-amplify/cli > amplify-provider-awscloudformation > @aws-amplify/graphql-transformer-interfaces > @aws-cdk/aws-rds@1.124.0" has unmet peer dependency "@aws-cdk/cx-api@1.124.0". 2021-11-17T02:41:42.228Z [WARNING]: warning "@aws-amplify/cli > amplify-provider-awscloudformation > @aws-amplify/graphql-model-transformer > @aws-cdk/aws-appsync@1.124.0" has unmet peer dependency "@aws-cdk/aws-cognito@1.124.0". 2021-11-17T02:41:42.228Z [WARNING]: warning "@aws-amplify/cli > amplify-provider-awscloudformation > @aws-amplify/graphql-model-transformer > @aws-cdk/aws-appsync@1.124.0" has unmet peer dependency "@aws-cdk/aws-elasticsearch@1.124.0". 2021-11-17T02:41:42.228Z [WARNING]: warning "@aws-amplify/cli > amplify-provider-awscloudformation > @aws-amplify/graphql-model-transformer > @aws-cdk/aws-appsync@1.124.0" has unmet peer dependency "@aws-cdk/aws-rds@1.124.0". 2021-11-17T02:42:00.562Z [INFO]: [4/4] Building fresh packages... 2021-11-17T02:42:03.185Z [INFO]: success Installed "@aws-amplify/cli@7.3.5" with binaries: 2021-11-17T02:42:03.186Z [INFO]: - amplify 2021-11-17T02:42:03.186Z [INFO]: Done in 50.80s. 2021-11-17T02:42:03.222Z [INFO]: # Executing command: amplify --version 2021-11-17T02:42:08.754Z [INFO]: The following official plugins are missing or inactive: 2021-11-17T02:42:08.756Z [INFO]: awscloudformation: provider | amplify-provider-awscloudformation@5.3.3 analytics: category | amplify-category-analytics@3.2.1 api: category | amplify-category-api@3.3.0 function: category | amplify-category-function@3.3.0 geo: category | amplify-category-geo@2.2.1 hosting: category | amplify-category-hosting@3.2.1 hosting: category | amplify-console-hosting@2.2.1 hosting: category | amplify-container-hosting@2.3.0 interactions: category | amplify-category-interactions@3.2.1 notifications: category | amplify-category-notifications@2.19.4 predictions: category | amplify-category-predictions@3.2.1 xr: category | amplify-category-xr@3.2.1 codegen: util | amplify-codegen@^2.23.1 flutter: frontend | amplify-frontend-flutter@1.3.0 android: frontend | amplify-frontend-android@3.3.0 ios: frontend | amplify-frontend-ios@3.3.0 javascript: frontend | amplify-frontend-javascript@3.3.0 mock: util | amplify-util-mock@4.2.4 2021-11-17T02:42:08.815Z [INFO]: 7.3.5 2021-11-17T02:42:09.170Z [INFO]: # Completed phase: preBuild # Starting phase: build # Executing command: pwd /codebuild/output/src517466540/src/akeero-admin # Executing command: ls -la 2021-11-17T02:42:09.171Z [INFO]: total 796 drwxr-xr-x 8 root root 4096 Nov 17 02:41 . drwxr-xr-x 3 root root 4096 Nov 17 02:38 .. drwxr-xr-x 6 root root 4096 Nov 17 02:38 amplify -rwxrwxrwx 1 root root 4935 Nov 17 02:41 amplify.sh -rw-r--r-- 1 root root 1761 Nov 17 02:40 amplify.yml -rw-r--r-- 1 root root 645 Nov 17 02:38 .editorconfig -rw-r--r-- 1 root root 14 Nov 17 02:38 .eslintignore -rw-r--r-- 1 root root 509 Nov 17 02:38 .eslintrc.json drwxr-xr-x 8 root root 4096 Nov 17 02:38 .git -rw-r--r-- 1 root root 777 Nov 17 02:38 .gitignore -rw-r--r-- 1 root root 323 Nov 17 02:38 .graphqlconfig.yml -rw-r--r-- 1 root root 273 Nov 17 02:38 jest.config.js drwxr-xr-x 1194 root root 36864 Nov 17 02:40 node_modules -rw-r--r-- 1 root root 3031 Nov 17 02:38 package.json -rw-r--r-- 1 root root 79 Nov 17 02:38 .prettierrc drwxr-xr-x 2 root root 4096 Nov 17 02:38 public -rw-r--r-- 1 root root 3899 Nov 17 02:38 README.md drwxr-xr-x 12 root root 4096 Nov 17 02:38 src -rw-r--r-- 1 root root 874 Nov 17 02:38 tsconfig.json drwxr-xr-x 2 root root 4096 Nov 17 02:38 .vscode -rw-r--r-- 1 root root 692384 Nov 17 02:38 yarn.lock 2021-11-17T02:42:14.218Z [INFO]: Found no provider plugins 2021-11-17T02:42:14.220Z [INFO]: Run 'amplify plugin scan' to scan your system for provider plugins. 2021-11-17T02:42:14.220Z [INFO]: Failed to pull the backend. 2021-11-17T02:42:14.222Z [INFO]: Found no provider plugins 2021-11-17T02:42:14.222Z [INFO]: Error: Found no provider plugins  at getProvider (/usr/local/share/.config/yarn/global/node_modules/@aws-amplify/cli/lib/attach-backend-steps/a10-queryProvider.js:43:15)  at Object.queryProvider (/usr/local/share/.config/yarn/global/node_modules/@aws-amplify/cli/lib/attach-backend-steps/a10-queryProvider.js:28:28)  at Object.attachBackend (/usr/local/share/.config/yarn/global/node_modules/@aws-amplify/cli/lib/attach-backend.js:38:35)  at Object.run (/usr/local/share/.config/yarn/global/node_modules/@aws-amplify/cli/lib/commands/pull.js:64:32)  at Object.executeAmplifyCommand (/usr/local/share/.config/yarn/global/node_modules/@aws-amplify/cli/lib/index.js:288:29)  at processTicksAndRejections (node:internal/process/task_queues:96:5)  at async executePluginModuleCommand (/usr/local/share/.config/yarn/global/node_modules/@aws-amplify/cli/lib/execution-manager.js:187:5)  at async Object.executeCommand (/usr/local/share/.config/yarn/global/node_modules/@aws-amplify/cli/lib/execution-manager.js:35:9)  at async Object.run (/usr/local/share/.config/yarn/global/node_modules/@aws-amplify/cli/lib/index.js:162:9) 2021-11-17T02:42:14.239Z [ERROR]: !!! Build failed 2021-11-17T02:42:14.239Z [ERROR]: !!! Non-Zero Exit Code detected 2021-11-17T02:42:14.239Z [INFO]: # Starting environment caching... 2021-11-17T02:42:14.240Z [INFO]: # Uploading environment cache artifact... 2021-11-17T02:42:14.305Z [INFO]: # Environment caching completed Terminating logging... ```

Additional information

Above is extracted from this build: eu-west-1#/d16xma096tmdk6/feature-sc-1422/21 The previous 20 builds may also be relevant as they were other attempts to solve the same issue.

Side Issue: Cloning Repository Step marked as successful

Logs from: eu-west-1#/d16xma096tmdk6/prod/15 ``` # Put your logs below this line 2021-11-16T19:34:40.245Z [INFO]: Git SSH Key acquired 2021-11-16T19:34:40.321Z [INFO]: # Cloning repository: git@github.com:Akeero/akeero-admin.git 2021-11-16T19:34:40.374Z [INFO]: Agent pid 136 2021-11-16T19:34:40.396Z [INFO]: Identity added: /root/.ssh/git_rsa (/root/.ssh/git_rsa) 2021-11-16T19:34:40.583Z [INFO]: Cloning into 'akeero-admin'... 2021-11-16T19:34:41.097Z [INFO]: Warning: Permanently added the ECDSA host key for IP address '140.82.121.4' to the list of known hosts. 2021-11-16T19:34:43.412Z [INFO]: # Switching to commit: a723c66142bb1f4aca3306c0f418274016c3ca3f 2021-11-16T19:34:43.442Z [INFO]: Agent pid 149 2021-11-16T19:34:43.516Z [INFO]: Identity added: /root/.ssh/git_rsa (/root/.ssh/git_rsa) Note: switching to 'a723c66142bb1f4aca3306c0f418274016c3ca3f'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example: git switch -c Or undo this operation with: git switch - Turn off this advice by setting config variable advice.detachedHead to false HEAD is now at a723c66 Merge pull request #59 from Akeero/main 2021-11-16T19:34:43.522Z [INFO]: Successfully cleaned up Git credentials 2021-11-16T19:34:43.522Z [INFO]: # Checking for Git submodules at: /codebuild/output/src793049893/src/akeero-admin/.gitmodules 2021-11-16T19:34:43.543Z [INFO]: # Retrieving environment cache... 2021-11-16T19:34:43.600Z [INFO]: # Retrieved environment cache 2021-11-16T19:34:43.601Z [INFO]: ---- Setting Up SSM Secrets ---- 2021-11-16T19:34:43.601Z [INFO]: SSM params {"Path":"/amplify/d16xma096tmdk6/prod/","WithDecryption":true} 2021-11-16T19:34:43.687Z [INFO]: # Determining if there are buildable backend changes in the amplify directory of the repository... 2021-11-16T19:34:43.738Z [INFO]: # Last built commit: 60f015922856c72f7c1f2bc7924037c5a433ab9e 2021-11-16T19:34:43.744Z [INFO]: # Differences detected. 2021-11-16T19:34:43.745Z [INFO]: # Continuing with backend build... 2021-11-16T19:34:49.710Z [INFO]: # Patching NPM package '@aws-amplify/cli' from 4.29.4 to 7.3.3... 2021-11-16T19:35:30.587Z [INFO]: npm WARN deprecated graphql-import@0.7.1: GraphQL Import has been deprecated and merged into GraphQL Tools, so it will no longer get updates. Use GraphQL Tools instead to stay up-to-date! Check out https://www.graphql-tools.com/docs/migration-from-import for migration and https://the-guild.dev/blog/graphql-tools-v6 for new changes. 2021-11-16T19:35:46.143Z [INFO]: npm WARN deprecated @graphql-toolkit/common@0.9.7: GraphQL Toolkit is deprecated and merged into GraphQL Tools, so it will no longer get updates. Use GraphQL Tools instead to stay up-to-date! Check out https://www.graphql-tools.com/docs/migration-from-toolkit for migration and https://the-guild.dev/blog/graphql-tools-v6 for new changes. 2021-11-16T19:35:50.584Z [INFO]: npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated 2021-11-16T19:35:50.599Z [INFO]: npm WARN 2021-11-16T19:35:50.600Z [INFO]: deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated 2021-11-16T19:35:51.057Z [INFO]: npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3. 2021-11-16T19:35:52.945Z [INFO]: npm 2021-11-16T19:35:52.946Z [INFO]: WARN deprecated @graphql-toolkit/common@0.6.6: GraphQL Toolkit is deprecated and merged into GraphQL Tools, so it will no longer get updates. Use GraphQL Tools instead to stay up-to-date! Check out https://www.graphql-tools.com/docs/migration-from-toolkit for migration and https://the-guild.dev/blog/graphql-tools-v6 for new changes. 2021-11-16T19:35:58.689Z [INFO]: npm 2021-11-16T19:35:58.691Z [INFO]: WARN deprecated event-to-promise@0.8.0: Use promise-toolbox/fromEvent instead 2021-11-16T19:36:58.819Z [INFO]: npm 2021-11-16T19:36:58.821Z [INFO]: WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/@aws-amplify/cli/node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) 2021-11-16T19:36:58.827Z [INFO]: npm 2021-11-16T19:36:58.828Z [INFO]: WARN amplify-codegen@2.26.15 requires a peer of amplify-cli-core@^1.17.2 but none is installed. You must install peer dependencies yourself. 2021-11-16T19:36:58.833Z [INFO]: npm 2021-11-16T19:36:58.834Z [INFO]: WARN amplify-codegen@2.26.15 requires a peer of graphql-transformer-core@^6.26.2 but none is installed. You must install peer dependencies yourself. 2021-11-16T19:36:58.834Z [INFO]: 2021-11-16T19:36:58.934Z [INFO]: # Done patching NPM package '@aws-amplify/cli' to version 7.3.3 2021-11-16T19:36:58.947Z [INFO]: # Retrieving cache... 2021-11-16T19:37:06.791Z [INFO]: # Extracting cache... 2021-11-16T19:37:13.402Z [INFO]: # Extraction completed ```
kaustavghosh06 commented 2 years ago

@chrismilleruk Could you please use npm install -g @aws-amplify/cli instead of using yarn and if you're still experiencing this issue? We've seen issues with yarn installations in the past like this one - https://github.com/aws-amplify/amplify-cli/issues/8942

chrismilleruk commented 2 years ago

@kaustavghosh06 yes, I switched to yarn after npm i -g @aws-amplify/cli failed, here is the buildspec and logs from that run:

Buildspec ```yaml version: 1 backend: phases: preBuild: commands: - "# Check Versions" - node --version - npm --version - yarn --version - which amplify - amplify --version - nvm install 16 - nvm use 16 - npm install -g @aws-amplify/cli@latest - amplify --version build: commands: - "# Execute Amplify CLI with the helper script" - pwd - ls -la - amplifyPush --simple ... ```
Backend Build failure snippet - eu-west-1#/d16xma096tmdk6/feature-sc-1422/18 ``` # Starting phase: preBuild # Executing command: node --version 2021-11-17T02:07:57.626Z [INFO]: v12.21.0 2021-11-17T02:07:57.627Z [INFO]: # Executing command: npm --version 2021-11-17T02:07:57.750Z [INFO]: 6.14.11 2021-11-17T02:07:57.753Z [INFO]: # Executing command: yarn --version 2021-11-17T02:07:58.292Z [INFO]: 1.22.0 2021-11-17T02:07:58.298Z [INFO]: # Executing command: which amplify 2021-11-17T02:07:58.299Z [INFO]: /root/.nvm/versions/node/v12.21.0/bin/amplify 2021-11-17T02:07:58.299Z [INFO]: # Executing command: amplify --version 2021-11-17T02:08:02.959Z [INFO]: 7.3.4 2021-11-17T02:08:03.227Z [INFO]: # Executing command: nvm install 16 2021-11-17T02:08:03.641Z [INFO]: Downloading and installing node v16.13.0... 2021-11-17T02:08:03.842Z [WARNING]: Downloading https://nodejs.org/dist/v16.13.0/node-v16.13.0-linux-x64.tar.gz... 2021-11-17T02:08:03.966Z [WARNING]: 2021-11-17T02:08:03.966Z [WARNING]: 1.3% 2021-11-17T02:08:04.066Z [WARNING]: #################### 2021-11-17T02:08:04.066Z [WARNING]: ##### 35.7% 2021-11-17T02:08:04.169Z [WARNING]: ##################################### 2021-11-17T02:08:04.169Z [WARNING]: #################### 79.6% 2021-11-17T02:08:04.211Z [WARNING]: ######################### 2021-11-17T02:08:04.211Z [WARNING]: ############################################### 100.0% 2021-11-17T02:08:04.228Z [WARNING]: Computing checksum with sha256sum 2021-11-17T02:08:04.338Z [WARNING]: Checksums matched! 2021-11-17T02:08:05.634Z [INFO]: Now using node v16.13.0 (npm v8.1.0) 2021-11-17T02:08:05.663Z [INFO]: # Executing command: nvm use 16 2021-11-17T02:08:06.250Z [INFO]: Now using node v16.13.0 (npm v8.1.0) 2021-11-17T02:08:06.252Z [INFO]: # Executing command: npm install -g @aws-amplify/cli@latest 2021-11-17T02:08:09.449Z [WARNING]: npm WARN ERESOLVE overriding peer dependency 2021-11-17T02:08:09.452Z [WARNING]: npm WARN While resolving: amplify-codegen@2.26.15 npm WARN Found: amplify-cli-core@2.3.0 npm WARN node_modules/@aws-amplify/cli/node_modules/amplify-cli-core npm WARN amplify-cli-core@"2.3.0" from @aws-amplify/cli@7.3.4 npm WARN node_modules/@aws-amplify/cli npm WARN @aws-amplify/cli@"7.3.4" from the root project npm WARN 26 more (@aws-amplify/amplify-category-auth, ...) npm WARN npm WARN Could not resolve dependency: npm WARN peer amplify-cli-core@"^1.17.2" from amplify-codegen@2.26.15 npm WARN node_modules/@aws-amplify/cli/node_modules/amplify-codegen npm WARN amplify-codegen@"^2.23.1" from @aws-amplify/cli@7.3.4 npm WARN node_modules/@aws-amplify/cli npm WARN 3 more (amplify-provider-awscloudformation, ...) npm WARN npm WARN Conflicting peer dependency: amplify-cli-core@1.32.0 npm WARN node_modules/amplify-cli-core npm WARN peer amplify-cli-core@"^1.17.2" from amplify-codegen@2.26.15 npm WARN node_modules/@aws-amplify/cli/node_modules/amplify-codegen npm WARN amplify-codegen@"^2.23.1" from @aws-amplify/cli@7.3.4 npm WARN node_modules/@aws-amplify/cli npm WARN 3 more (amplify-provider-awscloudformation, ...) 2021-11-17T02:08:09.455Z [WARNING]: npm 2021-11-17T02:08:09.456Z [WARNING]: WARN ERESOLVE overriding peer dependency 2021-11-17T02:08:09.456Z [WARNING]: npm WARN While resolving: amplify-codegen@2.26.15 npm WARN Found: graphql-transformer-core@7.2.1 npm WARN node_modules/@aws-amplify/cli/node_modules/graphql-transformer-core npm WARN graphql-transformer-core@"7.2.1" from @aws-amplify/cli@7.3.4 npm 2021-11-17T02:08:09.456Z [WARNING]: WARN node_modules/@aws-amplify/cli npm WARN @aws-amplify/cli@"7.3.4" from the root project npm WARN 5 more (amplify-category-api, amplify-category-function, ...) npm WARN npm WARN Could not resolve dependency: npm WARN peer graphql-transformer-core@"^6.26.2" from amplify-codegen@2.26.15 npm WARN node_modules/@aws-amplify/cli/node_modules/amplify-codegen npm 2021-11-17T02:08:09.456Z [WARNING]: WARN amplify-codegen@"^2.23.1" from @aws-amplify/cli@7.3.4 npm WARN node_modules/@aws-amplify/cli npm WARN 3 more (amplify-provider-awscloudformation, ...) npm WARN npm WARN Conflicting peer dependency: graphql-transformer-core@6.31.0 npm WARN node_modules/graphql-transformer-core npm WARN peer graphql-transformer-core@"^6.26.2" from amplify-codegen@2.26.15 npm WARN node_modules/@aws-amplify/cli/node_modules/amplify-codegen npm WARN amplify-codegen@"^2.23.1" from @aws-amplify/cli@7.3.4 npm WARN 2021-11-17T02:08:09.456Z [WARNING]: node_modules/@aws-amplify/cli npm WARN 3 more (amplify-provider-awscloudformation, ...) 2021-11-17T02:09:42.469Z [WARNING]: npm WARN deprecated 2021-11-17T02:09:42.474Z [WARNING]: event-to-promise@0.8.0: Use promise-toolbox/fromEvent instead 2021-11-17T02:09:42.513Z [WARNING]: npm WARN deprecated 2021-11-17T02:09:42.514Z [WARNING]: urix@0.1.0: Please see https://github.com/lydell/urix#deprecated 2021-11-17T02:09:42.691Z [WARNING]: npm 2021-11-17T02:09:42.691Z [WARNING]: WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated 2021-11-17T02:09:43.310Z [WARNING]: npm WARN 2021-11-17T02:09:43.311Z [WARNING]: deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. 2021-11-17T02:09:43.470Z [WARNING]: npm 2021-11-17T02:09:43.470Z [WARNING]: WARN deprecated graphql-import@0.7.1: GraphQL Import has been deprecated and merged into GraphQL Tools, so it will no longer get updates. Use GraphQL Tools instead to stay up-to-date! Check out https://www.graphql-tools.com/docs/migration-from-import for migration and https://the-guild.dev/blog/graphql-tools-v6 for new changes. 2021-11-17T02:09:43.671Z [WARNING]: npm WARN 2021-11-17T02:09:43.672Z [WARNING]: deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. 2021-11-17T02:09:43.737Z [WARNING]: npm WARN 2021-11-17T02:09:43.737Z [WARNING]: deprecated @graphql-toolkit/common@0.9.7: GraphQL Toolkit is deprecated and merged into GraphQL Tools, so it will no longer get updates. Use GraphQL Tools instead to stay up-to-date! Check out https://www.graphql-tools.com/docs/migration-from-toolkit for migration and https://the-guild.dev/blog/graphql-tools-v6 for new changes. 2021-11-17T02:09:43.737Z [WARNING]: npm 2021-11-17T02:09:43.737Z [WARNING]: WARN deprecated @graphql-toolkit/common@0.9.7: GraphQL Toolkit is deprecated and merged into GraphQL Tools, so it will no longer get updates. Use GraphQL Tools instead to stay up-to-date! Check out https://www.graphql-tools.com/docs/migration-from-toolkit for migration and https://the-guild.dev/blog/graphql-tools-v6 for new changes. 2021-11-17T02:09:43.787Z [WARNING]: npm WARN 2021-11-17T02:09:43.788Z [WARNING]: deprecated uuid@3.3.2: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. 2021-11-17T02:09:45.290Z [WARNING]: npm WARN 2021-11-17T02:09:45.290Z [WARNING]: deprecated @graphql-toolkit/common@0.6.6: GraphQL Toolkit is deprecated and merged into GraphQL Tools, so it will no longer get updates. Use GraphQL Tools instead to stay up-to-date! Check out https://www.graphql-tools.com/docs/migration-from-toolkit for migration and https://the-guild.dev/blog/graphql-tools-v6 for new changes. 2021-11-17T02:09:46.858Z [WARNING]: npm 2021-11-17T02:09:46.859Z [WARNING]: WARN deprecated graphql-tools@4.0.8: This package has been deprecated and now it only exports makeExecutableSchema.\nAnd it will no longer receive updates.\nWe recommend you to migrate to scoped packages such as @graphql-tools/schema, @graphql-tools/utils and etc.\nCheck out https://www.graphql-tools.com to learn what package you should use instead 2021-11-17T02:09:56.325Z [WARNING]: npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js. 2021-11-17T02:09:56.327Z [WARNING]: npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js. npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js. 2021-11-17T02:10:01.036Z [WARNING]: npm 2021-11-17T02:10:01.039Z [WARNING]: ERR! code 127 npm ERR! path /root/.nvm/versions/node/v16.13.0/lib/node_modules/@aws-amplify/cli/node_modules/babel-runtime/node_modules/core-js npm ERR! command failed npm ERR! command sh -c node -e "try{require('./postinstall')}catch(e){}" npm ERR! sh: node: command not found 2021-11-17T02:10:01.111Z [WARNING]: 2021-11-17T02:10:01.112Z [WARNING]: npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2021-11-17T02_10_01_051Z-debug.log 2021-11-17T02:10:01.112Z [HELP]: Outputting the npm debug log 0 verbose cli [ 0 verbose cli '/root/.nvm/versions/node/v16.13.0/bin/node', ... 6858 verbose pkgid core-js@2.6.12 6859 verbose cwd /codebuild/output/src313861280/src/akeero-admin 6860 verbose Linux 4.14.248-189.473.amzn2.x86_64 6861 verbose argv "/root/.nvm/versions/node/v16.13.0/bin/node" "/root/.nvm/versions/node/v16.13.0/bin/npm" "install" "-g" "@aws-amplify/cli@latest" 6862 verbose node v16.13.0 6863 verbose npm v8.1.0 6864 error code 127 6865 error path /root/.nvm/versions/node/v16.13.0/lib/node_modules/@aws-amplify/cli/node_modules/babel-runtime/node_modules/core-js 6866 error command failed 6867 error command sh -c node -e "try{require('./postinstall')}catch(e){}" 6868 error sh: node: command not found 6869 verbose exit 127 2021-11-17T02:10:01.172Z [ERROR]: !!! Build failed 2021-11-17T02:10:01.172Z [ERROR]: !!! Non-Zero Exit Code detected 2021-11-17T02:10:01.172Z [INFO]: # Starting environment caching... 2021-11-17T02:10:01.173Z [INFO]: # Uploading environment cache artifact... 2021-11-17T02:10:01.231Z [INFO]: # Environment caching completed Terminating logging... ```
kaustavghosh06 commented 2 years ago

@chrismilleruk Does it work with the default Node version which Amplify build provides and NPM CLI installation?

chrismilleruk commented 2 years ago

It's a reasonable question but it might be trying to create a workaround / resolve a different issue. Specifically (& rather sarcastically), "...upgrade Node AND Amplify prior to amplifyPush in build" definitely does not work if we use the "default Node version which Amplify build provides and NPM CLI installation." 😁

... however, for your info, my specific use case & background:

In our case, the correct & specific version of tsc is required for this build step:

snippet from https://docs.amplify.aws/cli/function/build-options/ ```json { "scripts": { "amplify:generateReport": "cd amplify/backend/function/generateReport && tsc -p ./tsconfig.json && cd -" }, } ```

The specific tsc version we need is stored in the package.json file so a simple npm install -g typescript against node 12 doesn't really work for me as it will introduce inconsistencies.

npm install with the default 'NPM CLI installation' produces errors due to a package-lock.json version conflict.

I'm not too keen to look at any temporary workarounds for this issue since a recent opaque change to _LIVE_UPDATES caused a build pipeline to fail spectacularly, in prod, 24h before a conference.

I've disabled lambda pre-build for now and I'm looking for a robust way to upgrade the build container to the correct versions prior to running the build. Preferably without installing the same thing multiple times against different versions.

I hope this helps & provides the background context you need to understand why I'm attempting to upgrade node & reinstall amplify at this point in the build.

chrismilleruk commented 2 years ago

@kaustavghosh06 thanks in advance for your help and let me know if I can add any more info for you.

lazpavel commented 2 years ago

Hi @chrismilleruk, is it possible for you to use node 14? Please let us know if you're still having issues after that.

josefaidt commented 2 years ago

Hey @chrismilleruk :wave: as a workaround can you try adding the string "packaged-node-modules" to the pluginDirectories section of the ~/.amplify/plugins.json file and try to redeploy?

{
  "pluginDirectories": [
    "cli-local-node-modules",
    "cli-parent-directory",
    "global-node-modules",
+   "packaged-node-modules"
  ],
  // ...
}

For reference: https://github.com/josefaidt/9209/blob/main/scripts/patch.js

chrismilleruk commented 2 years ago

@lazpavel, @josefaidt πŸ‘‹ Apologies for the slow response. I've created a ticket to try these approaches and will let you know how it goes.

josefaidt commented 2 years ago

Hey @chrismilleruk :wave: just wanted to follow-up on this one and see if you'd had a chance to try out the workaround posted above?

chrismilleruk commented 2 years ago

Hi @josefaidt, @lazpavel, I've had a chance to revisit this and test some more this evening, with mixed results. There seem to be a few things overlapping here so I did some brute force testing to try and isolate the key factors.

A quick reminder that the goal (for me at least) is to upgrade node (Active LTS: v16, Current: v17) with a working amplify CLI at preBuild. The two workarounds mentioned are "use node 14" and "add the string "packaged-node-modules" to the pluginDirectories section of the ~/.amplify/plugins.json".

The patch seems to be non-impacting from what I can tell. The patch works for nvm install v14 and nvm install v16 when using yarn

The target version of Node (and NPM) coupled with the amplify-cli install method seems to have the greatest impact & correlation.

I see also that the main build provision script has been updated and the default version of node is now v14.18.1 instead of v12.21.0. A great improvement πŸ‘. We need to nvm install something in order to cause the issue so I have just performed a nvm install 14.18.3.

Variations explored

NO PATCH OR node install-9209-patch.js

nvm install 16 OR nvm install 14.18.3 OR nvm use 16

NO AMPLIFY INSTALL OR npm install -g @aws-amplify/cli@latest OR yarn global add @aws-amplify/cli OR npm config set user 0 && npm config set unsafe-perm true && npm install -g @aws-amplify/cli@latest

Test command

amplify --version

Successful combos

nvm install 14 with npm install -g

If you want a minor or patch update to v14, use npm install -g.

node install-9209-patch.js + nvm install 14.18.3 + npm install -g @aws-amplify/cli@latest NO PATCH + nvm install 14.18.3 + npm install -g @aws-amplify/cli@latest

Success πŸ†— node v14.18.3 (npm v6.14.15)

version: 1
backend:
  phases:
    preBuild:
      commands:
        - "# Check Versions"
        - node --version && npm --version && yarn --version && amplify --version
        - "# Upgrade from 14.18.1 to 14.x"
        - nvm install 14
        - npm install -g @aws-amplify/cli@latest
        - amplify --version

nvm install 14 or 16 with yarn global add

If you want to upgrade to v14 or v16 with yarn global add, use the patch from @josefaidt above (https://github.com/josefaidt/9209/blob/main/scripts/patch.js).

node install-9209-patch.js + nvm install 14 + yarn global add @aws-amplify/cli node install-9209-patch.js + nvm install 16 + yarn global add @aws-amplify/cli

Success πŸ†— node v16.13.2 (npm v8.1.2) yarn@1.22.0

version: 1
backend:
  phases:
    preBuild:
      commands:
        - "# Check Versions"
        - node --version && npm --version && yarn --version && amplify --version
        - "# Upgrade from 14.18.1 to 16.x"
        - node install-9209-patch.js
        - nvm install 16
        - yarn global add @aws-amplify/cli
        - amplify --version

nvm use 16 with npm config set unsafe-perm true

It is also possible to nvm _use_ 16 to access v16.13.0 since it is preinstalled but it is not recommended.

Using npm config set user 0 && npm config set unsafe-perm true && npm install -g @aws-amplify/cli@latest to update amplify

Details of all runs

All attempts and a brief summary of each error `NO PATCH` + `nvm install 16` + `NO AMPLIFY INSTALL` > `amplify.sh: line 23: amplify: command not found` `node install-9209-patch.js` + `nvm install 16` + `NO AMPLIFY INSTALL` > `amplify.sh: line 26: amplify: command not found` `node install-9209-patch.js` + `nvm install 16` + `npm install -g @aws-amplify/cli@latest` ``` 6883 verbose pkgid core-js@2.6.12 ... 6890 error path /root/.nvm/versions/node/v16.13.2/lib/node_modules/@aws-amplify/cli/node_modules/babel-runtime/node_modules/core-js 6891 error command failed 6892 error command sh -c node -e "try{require('./postinstall')}catch(e){}" 6893 error sh: node: command not found 6894 verbose exit 127 ``` `node install-9209-patch.js` + `nvm install 14.18.3` + `npm install -g @aws-amplify/cli@latest` > Success πŸ†— > node v14.18.3 (npm v6.14.15) `NO PATCH` + `nvm install 14.18.3` + `npm install -g @aws-amplify/cli@latest` > Success πŸ†— > node v14.18.3 (npm v6.14.15) `NO PATCH` + `nvm install 14.18.3` + `yarn global add @aws-amplify/cli` ``` 2022-01-26T01:08:17.037Z [INFO]: success Installed "@aws-amplify/cli@7.6.12" with binaries: 2022-01-26T01:08:17.037Z [INFO]: - amplify 2022-01-26T01:08:17.038Z [INFO]: Done in 53.87s. 2022-01-26T01:08:17.080Z [INFO]: # Executing command: amplify --version 2022-01-26T01:08:23.455Z [INFO]: 7.6.12 ``` `node install-9209-patch.js` + `nvm install 14.18.3` + `yarn global add @aws-amplify/cli` > Success πŸ†— > node v14.18.3 (npm v6.14.15) ``` 2022-01-26T01:07:20.154Z [INFO]: # Executing command: nvm install 14.18.3 2022-01-26T01:07:21.278Z [WARNING]: Checksums matched! 2022-01-26T01:07:22.340Z [INFO]: Now using node v14.18.3 (npm v6.14.15) ... 2022-01-26T01:07:22.944Z [INFO]: # Executing command: yarn global add @aws-amplify/cli 2022-01-26T01:07:23.174Z [INFO]: yarn global v1.22.0 ... 2022-01-26T01:08:17.037Z [INFO]: success Installed "@aws-amplify/cli@7.6.12" with binaries: 2022-01-26T01:08:17.037Z [INFO]: - amplify 2022-01-26T01:08:17.038Z [INFO]: Done in 53.87s. 2022-01-26T01:08:17.080Z [INFO]: # Executing command: amplify --version 2022-01-26T01:08:23.455Z [INFO]: 7.6.12 2022-01-26T01:08:23.816Z [INFO]: # Completed phase: preBuild ``` `node install-9209-patch.js` + `nvm install 16` + `yarn global add @aws-amplify/cli` > Success πŸ†— > node v16.13.2 (npm v8.1.2) > yarn@1.22.0 `node install-9209-patch.js` + `nvm install 16` + `npm install -g @aws-amplify/cli@latest` ``` 6883 verbose pkgid core-js@2.6.12 ... 6892 error command sh -c node -e "try{require('./postinstall')}catch(e){}" 6893 error sh: node: command not found 6894 verbose exit 127 ``` `node install-9209-patch.js` + `nvm install 16` + `npm config set user 0 && npm config set unsafe-perm true && npm install -g @aws-amplify/cli@latest` ``` 6883 verbose pkgid core-js@2.6.12 ... 6892 error command sh -c node -e "try{require('./postinstall')}catch(e){}" 6893 error sh: node: command not found 6894 verbose exit 127 ``` `node install-9209-patch.js` + `nvm use 16` + `NO AMPLIFY INSTALL` ``` 2022-01-26T01:50:50.025Z [INFO]: # Executing command: nvm use 16 2022-01-26T01:50:54.119Z [INFO]: Now using node v16.13.0 (npm v8.1.0) 2022-01-26T01:50:54.121Z [INFO]: # Executing command: amplify --version 2022-01-26T01:51:09.310Z [INFO]: Invalid feature flag configuration 2022-01-26T01:51:09.313Z [INFO]: These feature flags are defined in the "amplify/cli.json" configuration file and are unknown to the currently running Amplify CLI:  - project This issue likely happens when the project has been pushed with a newer version of Amplify CLI, try updating to a newer version. Ensure that the CI/CD pipeline is not using an older or pinned down version of Amplify CLI. Learn more about feature flags: https://docs.amplify.aws/cli/reference/feature-flags 2022-01-26T01:51:09.323Z [ERROR]: !!! Build failed 2022-01-26T01:51:09.323Z [ERROR]: !!! Non-Zero Exit Code detected ``` `node install-9209-patch.js` + `nvm use 16` + `npm config set user 0 && npm config set unsafe-perm true && npm install -g @aws-amplify/cli@latest` > Success πŸ†— > node v16.13.0 (npm v8.1.0) > amplify --version > 7.6.12 `NO PATCH` + `nvm use 16` + `npm config set user 0 && npm config set unsafe-perm true && npm install -g @aws-amplify/cli@latest` > Success πŸ†— > node v16.13.0 (npm v8.1.0) > amplify --version > 7.6.12 `NO PATCH` + `nvm use 16` + `yarn global add @aws-amplify/cli` ``` success Installed "@aws-amplify/cli@7.6.12" with binaries: 2022-01-26T02:44:51.930Z [INFO]: - amplify 2022-01-26T02:44:51.931Z [INFO]: Done in 46.13s. 2022-01-26T02:44:51.983Z [INFO]: # Executing command: amplify --version 2022-01-26T02:45:15.079Z [INFO]: Invalid feature flag configuration 2022-01-26T02:45:15.085Z [INFO]: These feature flags are defined in the "amplify/cli.json" configuration file and are unknown to the currently running Amplify CLI:  - project This issue likely happens when the project has been pushed with a newer version of Amplify CLI, try updating to a newer version. Ensure that the CI/CD pipeline is not using an older or pinned down version of Amplify CLI. Learn more about feature flags: https://docs.amplify.aws/cli/reference/feature-flags ``` `NO PATCH` + `nvm install 16` + `yarn global add @aws-amplify/cli` ``` # Executing command: amplify --version 2022-01-26T02:57:26.427Z [INFO]: The following official plugins are missing or inactive: 2022-01-26T02:57:26.430Z [INFO]: awscloudformation: provider | amplify-provider-awscloudformation@5.8.11 analytics: category | amplify-category-analytics@3.2.13 ... ```
josefaidt commented 2 years ago

Hey @chrismilleruk thank you for taking the time to include those details! The "packaged-node-modules" line added to the plugins JSON file should be all we need to resolve the "missing plugins..." error regardless of Node version, though I'm unsure what issues you may have encountered with the preinstalled Node version 16. In any event I'm glad to hear that you're unblocked πŸ™‚

chrismilleruk commented 2 years ago

Hey @josefaidt, No problem, sorry for the big blogpost..

Just checking again with a clear head and I can see I was wrong (copy paste error).

The patch in fact DID work for both v16 and v14 when using Yarn to upgrade amplify.

Thanks again Chris

chrismilleruk commented 2 years ago

I've updated the summary comment above for future readers.

l20DfX35JnKBfRn commented 8 months ago

Future readers:

I've managed to get next 14 working on amplify with cloudformation without needing to create custom image hosted on ECR...

Just use the public.ecr.aws/sam/build-nodejs[version].x:latest images.

E.g., 18.x latest

    EnvironmentVariables:
        - Name: _CUSTOM_IMAGE
          Value: "public.ecr.aws/sam/build-nodejs18.x:latest"

*Thanks to https://www.cloudypandas.ch/posts/for-when-you-need-a-custom-amplify-build-image/

I hope this finds you well :)