amplify-hosting icon indicating copy to clipboard operation
amplify-hosting copied to clipboard

These feature flags are defined in the "amplify/cli.json" configuration file and are unknown to the currently running Amplify CLI:

Open vladimir-virlan opened this issue 3 years ago • 40 comments

Before opening, please confirm:

  • [X] I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
  • [X] I have searched for duplicate or closed issues.
  • [X] I have read the guide for submitting bug reports.
  • [X] 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?

v14.18.2

Amplify CLI Version

7.6.12

What operating system are you using?

Windows

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

Not really. Just added auth service and tried to deploy and keep on getting these errors. Actually I am following this guide:

https://aws.amazon.com/getting-started/hands-on/build-react-app-amplify-graphql/module-three/?e=gs2020&p=build-a-react-app-two

After that started getting the errors. Tried downgrading the cli (via npm package.json) to no avail.

Amplify Categories

auth

Amplify Commands

Not applicable

Describe the bug

The error happens when I push latest changes to github and the build triggers...

Expected behavior

Build to complete on push successfully..

Reproduction steps

  1. Follow this guide (or just add auth) and try to deploy by pushing to github: https://aws.amazon.com/getting-started/hands-on/build-react-app-amplify-graphql/module-three/?e=gs2020&p=build-a-react-app-two
  2. Make sure github is linked to your amplify and make sure frontend is connected to backend: image
  3. When you push the changes, provision is OK, but Build fails with the specificed error. Thanks

GraphQL schema(s)

# Put schemas below this line


Log output

# Put your logs below this line
                                # Starting phase: build
2022-01-26T19:51:53.229Z [INFO]: [31mInvalid feature flag configuration[39m
2022-01-26T19:51:53.231Z [INFO]: [31mThese feature flags are defined in the "amplify/cli.json" configuration file and are unknown to the currently running Amplify CLI:[39m
                                 [31m  - project[39m
                                 [31m  - graphqltransformer.transformerversion[39m
                                 [31m  - graphqltransformer.suppressschemamigrationprompt[39m
                                 [31m  - graphqltransformer.securityenhancementnotification[39m
                                 [31m  - auth.useenabledmfas[39m
                                 [31mThis issue likely happens when the project has been pushed with a newer version of Amplify CLI, try updating to a newer version.[39m
                                 [31mEnsure that the CI/CD pipeline is not using an older or pinned down version of Amplify CLI.[39m
                                 [31mLearn more about feature flags: https://docs.amplify.aws/cli/reference/feature-flags[39m
2022-01-26T19:51:53.243Z [ERROR]: !!! Build failed
2022-01-26T19:51:53.243Z [ERROR]: !!! Non-Zero Exit Code detected
2022-01-26T19:51:53.243Z [INFO]: # Starting environment caching...
2022-01-26T19:51:53.244Z [INFO]: # Uploading environment cache artifact...
2022-01-26T19:51:53.317Z [INFO]: # Environment caching completed
Terminating logging...

Additional information

No response

vladimir-virlan avatar Jan 26 '22 20:01 vladimir-virlan

Tried to install amplify with both npm and via curl, to no avail.

vladimir-virlan avatar Jan 26 '22 20:01 vladimir-virlan

BTW, I've also added these settings: image

vladimir-virlan avatar Jan 26 '22 20:01 vladimir-virlan

@vladimir-virlan do you have a particular Amplify CLI version pinned in Amplify Console? Can you share your amplify/cli.json file?

jhockett avatar Jan 26 '22 20:01 jhockett

I have an issue with the amplify/cli.json too. The client is asking me every time about a security enhancement question, even I already confirmed that. I think the updated flag was not written, so now, every time I update some resource (e.g. function), I have to push the API updates too.

My client version: 7.6.13.

cowjen01 avatar Jan 27 '22 02:01 cowjen01

Hi @jhockett. There is nothing special, no version mentioned in my cli.json file. Also, not sure how to check the version in the Amplify Web Console itself. I tried removing the flags it was complaining about manually from the cli.json file, but it still refused to work.

{
  "features": {
    "graphqltransformer": {
      "addmissingownerfields": true,
      "improvepluralization": false,
      "validatetypenamereservedwords": true,
      "useexperimentalpipelinedtransformer": true,
      "enableiterativegsiupdates": true,
      "secondarykeyasgsi": true,
      "skipoverridemutationinputtypes": true,
      "transformerversion": 2,
      "suppressschemamigrationprompt": true,
      "securityenhancementnotification": false
    },
    "frontend-ios": {
      "enablexcodeintegration": true
    },
    "auth": {
      "enablecaseinsensitivity": true,
      "useinclusiveterminology": true,
      "breakcirculardependency": true,
      "forcealiasattributes": false,
      "useenabledmfas": true
    },
    "codegen": {
      "useappsyncmodelgenplugin": true,
      "usedocsgeneratorplugin": true,
      "usetypesgeneratorplugin": true,
      "cleangeneratedmodelsdirectory": true,
      "retaincasestyle": true,
      "addtimestampfields": true,
      "handlelistnullabilitytransparently": true,
      "emitauthprovider": true,
      "generateindexrules": true,
      "enabledartnullsafety": true
    },
    "appsync": {
      "generategraphqlpermissions": true
    },
    "latestregionsupport": {
      "pinpoint": 1,
      "translate": 1,
      "transcribe": 1,
      "rekognition": 1,
      "textract": 1,
      "comprehend": 1
    },
    "project": {
      "overrides": true
    }
  }
}

Thank you

vladimir-virlan avatar Jan 27 '22 14:01 vladimir-virlan

As I was asking for help on discord, a guy Stephen gave me an idea to try and override the default image build settings. So this helped:

image

So local version of cli didn't have any effect on what happened on the server. But this setting helped.. Now I could see this in the logs. Looks like server image isn't using the latest version and this forced it (although my local CLI was the latest):

image

Looks like on the image it used quite an old version..

vladimir-virlan avatar Jan 27 '22 19:01 vladimir-virlan

@vladimir-virlan the Console always updates to the version in your build settings, which defaults to @latest of Amplify CLI, so the Console isn't actually using 6.3.1.

I don't see any issues in your cli.json file. Did pinning 7.6.13 fix the issue for you @vladimir-virlan?

@cowjen01 the issue you faced looks different from the original poster's. Would you mind opening a new issue so that we can better track and debug it?

jhockett avatar Jan 27 '22 20:01 jhockett

@cowjen01 the issue you faced looks different from the original poster's. Would you mind opening a new issue so that we can better track and debug it?

Sure, here it is: aws-amplify/amplify-cli#9628

cowjen01 avatar Jan 27 '22 21:01 cowjen01

@jhockett yes that fixed the issue. However I shouldn't have had to do that. I was expecting it to work out of the box.

vladimir-virlan avatar Jan 28 '22 10:01 vladimir-virlan

Hi :wave:, thanks for opening! While we look into this...

If this issue is related to custom domains, be sure to check the custom domains troubleshooting guide to see if that helps. Also, there is a more general troubleshooting FAQ that may be helpful for other questions.

Lastly, please make sure you've specified the App ID and Region in the issue!

github-actions[bot] avatar Jan 28 '22 21:01 github-actions[bot]

@vladimir-virlan glad to hear you're unblocked! The issue has been transferred so that the Console team can look into why you weren't getting the @latest Amplify CLI version by default.

jhockett avatar Jan 28 '22 21:01 jhockett

@vladimir-virlan the Console always updates to the version in your build settings, which defaults to @latest of Amplify CLI, so the Console isn't actually using 6.3.1.

holy moly I spent two hours adding/removing config files, re-pulling amplify, redeploying commits and researching this issue and eventually found this https://github.com/aws-amplify/amplify-cli/issues/9498. But it was still no help and finally forcing the Amplify CLI version in build settings works!

So how this issue was triggered for me was:

  • Everything was fine until 4 hours ago (last frontend deployment was 20 hours ago)
  • I connected another branch through the console (I only had 1 branch/frontend env)
  • I'm pretty sure I checked "Enable full-stack continuous deployments (CI/CD)"
  • Branched out from the main branch that was used to deploy 20 hours ago (so it should work)
  • Then during backend build phase, it failed with the error above
  • Till this point, I have not updated amplify cli, aws cli, modified any amplify settings, redeployed frontend/backend envs to the original env/branch through the console
  • There's definitely a bug somewhere that "downgrades" the CLI version upon connecting a branch

jakejcheng avatar Feb 05 '22 06:02 jakejcheng

Facing same issue while checking out the branch. Below is the error message. It was working fine till day before yesterday.

Invalid feature flag configuration

These feature flags are defined in the "amplify/cli.json" configuration file and are unknown to the currently running Amplify CLI:

  • graphqltransformer.showfieldauthnotification

This issue likely happens when the project has been pushed with a newer version of Amplify CLI, try updating to a newer version.

Learn more about feature flags: https://docs.amplify.aws/cli/reference/feature-flags

amitvchaudhary avatar Feb 06 '22 10:02 amitvchaudhary

Facing same issue while checking out the branch. Below is the error message. It was working fine till day before yesterday.

Invalid feature flag configuration

These feature flags are defined in the "amplify/cli.json" configuration file and are unknown to the currently running Amplify CLI:

  • graphqltransformer.showfieldauthnotification

This issue likely happens when the project has been pushed with a newer version of Amplify CLI, try updating to a newer version.

Learn more about feature flags: https://docs.amplify.aws/cli/reference/feature-flags

you should update version of Amplify CLI first. Go to source folder and run npm i -g @aws-amplify/cli @amitvchaudhary

duyetphamm avatar Feb 06 '22 16:02 duyetphamm

Adding amplify-cli to the build setting fixed the issue for me. Thanks

Abdeluswho avatar Feb 06 '22 19:02 Abdeluswho

@Abdeluswho , where did you add it? I am still having the issue.

gawshan avatar Feb 08 '22 18:02 gawshan

@Abdeluswho , where did you add it? I am still having the issue.

In the Amplify UI if you go to build settings and scroll all the way down there is a section for packages. Add it there and set it to latest. That should work

Abdeluswho avatar Feb 08 '22 19:02 Abdeluswho

It seems I've stumbled upon the same and a similar issue, respectively.

On my local machine, I am using version 7.6.21 of the @aws-amplify/cli package.

The backend build fails due to the following errors:

                                 ## Checking for associated backend environment...
                                 ## Backend environment association found
2022-02-21T16:11:03.570Z [INFO]: [31mInvalid feature flag configuration[39m
2022-02-21T16:11:03.570Z [INFO]: [31mThese feature flags are defined in the "amplify/cli.json" configuration file and are unknown to the currently running Amplify CLI:[39m
                                 [31m  - project[39m
                                 [31m  - graphqltransformer.transformerversion[39m
                                 [31m  - graphqltransformer.suppressschemamigrationprompt[39m
                                 [31m  - graphqltransformer.securityenhancementnotification[39m
                                 [31m  - graphqltransformer.showfieldauthnotification[39m
                                 [31m  - auth.useenabledmfas[39m
2022-02-21T16:11:03.571Z [INFO]: [31mThis issue likely happens when the project has been pushed with a newer version of Amplify CLI, try updating to a newer version.[39m
                                 [31mEnsure that the CI/CD pipeline is not using an older or pinned down version of Amplify CLI.[39m
2022-02-21T16:11:03.571Z [INFO]: [31mLearn more about feature flags: https://docs.amplify.aws/cli/reference/feature-flags[39m
2022-02-21T16:11:03.581Z [ERROR]: !!! Build failed
2022-02-21T16:11:03.581Z [ERROR]: !!! Non-Zero Exit Code detected
2022-02-21T16:11:03.581Z [INFO]: # Starting environment caching...
2022-02-21T16:11:03.581Z [INFO]: # Uploading environment cache artifact...
2022-02-21T16:11:03.674Z [INFO]: # Environment caching completed
Terminating logging...

To fix this, I configured the build image settings to override the default installed version of package Amplify CLI to above-mentioned version 7.6.21.

Now, it seems that Amplify fails to patch NPM package @aws-amplify/cli to 7.6.21:

2022-02-21T16:23:29.471Z [INFO]: # Node version 17 is available for installation
2022-02-21T16:23:29.542Z [INFO]: # Installing Node version 17
2022-02-21T16:23:35.510Z [INFO]: # Now using Node version 17
2022-02-21T16:23:36.282Z [WARNING]: Cannot find module '/root/.nvm/versions/node/v17.5.0/lib/node_modules/@aws-amplify/cli/package.json'
                                    Require stack:
                                    - /snapshot/AWSMobilePioneerExecute/src/plugins/patch/npm.js
                                    - /snapshot/AWSMobilePioneerExecute/src/plugins/patch/patch.js
                                    - /snapshot/AWSMobilePioneerExecute/pioneer.js
2022-02-21T16:23:36.282Z [INFO]: # Patching NPM package '@aws-amplify/cli' to 7.6.21...
2022-02-21T16:24:03.005Z [INFO]: npm WARN ERESOLVE overriding peer dependency
2022-02-21T16:25:25.324Z [INFO]: npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
2022-02-21T16:25:25.801Z [INFO]: npm
2022-02-21T16:25:25.802Z [INFO]: 
2022-02-21T16:25:25.802Z [INFO]: WARN
2022-02-21T16:25:25.802Z [INFO]: 
2022-02-21T16:25:25.803Z [INFO]: deprecated
2022-02-21T16:25:25.803Z [INFO]: [email protected]: Please see https://github.com/lydell/urix#deprecated
2022-02-21T16:25:26.641Z [INFO]: npm
2022-02-21T16:25:26.641Z [INFO]: WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
2022-02-21T16:25:26.970Z [INFO]: npm WARN deprecated
2022-02-21T16:25:26.971Z [INFO]: [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
2022-02-21T16:25:27.634Z [INFO]: npm
2022-02-21T16:25:27.634Z [INFO]: WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
2022-02-21T16:25:27.732Z [INFO]: npm
2022-02-21T16:25:27.733Z [INFO]: WARN deprecated [email protected]: 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.
2022-02-21T16:25:28.116Z [INFO]: npm WARN
2022-02-21T16:25:28.116Z [INFO]: deprecated [email protected]: 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.
2022-02-21T16:25:28.118Z [INFO]: npm
2022-02-21T16:25:28.118Z [INFO]: WARN deprecated [email protected]: 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.
2022-02-21T16:25:28.120Z [INFO]: npm
2022-02-21T16:25:28.120Z [INFO]: WARN deprecated [email protected]: 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.
2022-02-21T16:25:28.300Z [INFO]: npm WARN
2022-02-21T16:25:28.302Z [INFO]: deprecated @graphql-toolkit/[email protected]: 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.
2022-02-21T16:25:28.303Z [INFO]: npm
2022-02-21T16:25:28.303Z [INFO]: WARN deprecated @graphql-toolkit/[email protected]: 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.
2022-02-21T16:25:28.353Z [INFO]: npm WARN
2022-02-21T16:25:28.353Z [INFO]: deprecated [email protected]: 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.
2022-02-21T16:25:30.232Z [INFO]: npm WARN
2022-02-21T16:25:30.234Z [INFO]: deprecated @graphql-toolkit/[email protected]: 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.
2022-02-21T16:25:43.764Z [INFO]: npm WARN deprecated [email protected]: core-js@<3.4 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.
2022-02-21T16:25:43.765Z [INFO]: npm WARN deprecated [email protected]: core-js@<3.4 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
2022-02-21T16:25:43.765Z [INFO]: WARN deprecated [email protected]: core-js@<3.4 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.
2022-02-21T16:25:49.467Z [INFO]: npm ERR! code 127
2022-02-21T16:25:49.469Z [INFO]: npm ERR! path /root/.nvm/versions/node/v17.5.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!
2022-02-21T16:25:49.469Z [INFO]: sh: node: command not found
2022-02-21T16:25:49.469Z [INFO]: 
2022-02-21T16:25:49.470Z [INFO]: npm
2022-02-21T16:25:49.470Z [INFO]: ERR! A complete log of this run can be found in:
                                 npm ERR!     /root/.npm/_logs/2022-02-21T16_23_37_550Z-debug-0.log
2022-02-21T16:25:49.526Z [INFO]: ! Error patching NPM package '@aws-amplify/cli' to version 7.6.21
2022-02-21T16:25:49.538Z [INFO]: # Retrieving cache...
2022-02-21T16:25:51.925Z [INFO]: # Extracting cache...
2022-02-21T16:25:54.423Z [INFO]: # Extraction completed

As a consequence, the backend build still fails with the same errors:

                                 # Starting phase: build
2022-02-21T16:26:18.327Z [INFO]: [31mInvalid feature flag configuration[39m
2022-02-21T16:26:18.328Z [INFO]: [31mThese feature flags are defined in the "amplify/cli.json" configuration file and are unknown to the currently running Amplify CLI:[39m
                                 [31m  - project[39m
                                 [31m  - graphqltransformer.transformerversion[39m
                                 [31m  - graphqltransformer.suppressschemamigrationprompt[39m
                                 [31m  - graphqltransformer.securityenhancementnotification[39m
                                 [31m  - graphqltransformer.showfieldauthnotification[39m
                                 [31m  - auth.useenabledmfas[39m
                                 [31mThis issue likely happens when the project has been pushed with a newer version of Amplify CLI, try updating to a newer version.[39m
2022-02-21T16:26:18.328Z [INFO]: [31mEnsure that the CI/CD pipeline is not using an older or pinned down version of Amplify CLI.[39m
                                 [31mLearn more about feature flags: https://docs.amplify.aws/cli/reference/feature-flags[39m
2022-02-21T16:26:18.339Z [ERROR]: !!! Build failed
2022-02-21T16:26:18.340Z [ERROR]: !!! Non-Zero Exit Code detected
2022-02-21T16:26:18.340Z [INFO]: # Starting environment caching...
2022-02-21T16:26:18.340Z [INFO]: # Uploading environment cache artifact...
2022-02-21T16:26:18.408Z [INFO]: # Environment caching completed

Any ideas how to fix this?

martinburger avatar Feb 22 '22 10:02 martinburger

it appears that you are using node 17.5, can you try using 16? I was facing the same issue. nothing helped. but after 40 builds and trying tonnes of different solutions and configurations, I somehow managed to overcome the problem. but the configurations were probably messed up so even after the successful build authentication was not working. I deleted every resource and recreated a new project from scratch and it worked on the first try. 2 days of effort all in vain.

AniketKariya avatar Feb 22 '22 14:02 AniketKariya

it appears that you are using node 17.5, can you try using 16?

Good point. I tried it with overriding Node.js to version 16, too. Same issue:

2022-02-22T06:22:07.518Z [INFO]: # Node version 16 is available for installation
2022-02-22T06:22:07.519Z [INFO]: # Installing Node version 16
2022-02-22T06:22:12.729Z [INFO]: # Now using Node version 16
2022-02-22T06:22:13.439Z [WARNING]: Cannot find module '/root/.nvm/versions/node/v16.14.0/lib/node_modules/@aws-amplify/cli/package.json'
                                    Require stack:
                                    - /snapshot/AWSMobilePioneerExecute/src/plugins/patch/npm.js
                                    - /snapshot/AWSMobilePioneerExecute/src/plugins/patch/patch.js
                                    - /snapshot/AWSMobilePioneerExecute/pioneer.js
2022-02-22T06:22:13.439Z [INFO]: # Patching NPM package '@aws-amplify/cli' to 7.6.13...
2022-02-22T06:22:45.797Z [INFO]: npm WARN ERESOLVE overriding peer dependency
2022-02-22T06:24:08.684Z [INFO]: npm
2022-02-22T06:24:08.686Z [INFO]: WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
2022-02-22T06:24:09.015Z [INFO]: npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
2022-02-22T06:24:09.192Z [INFO]: npm
2022-02-22T06:24:09.192Z [INFO]: WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
2022-02-22T06:24:09.517Z [INFO]: npm WARN
2022-02-22T06:24:09.518Z [INFO]: deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
2022-02-22T06:24:10.416Z [INFO]: npm WARN
2022-02-22T06:24:10.416Z [INFO]: deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
2022-02-22T06:24:10.505Z [INFO]: npm WARN
2022-02-22T06:24:10.506Z [INFO]: deprecated [email protected]: 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.
2022-02-22T06:24:10.853Z [INFO]: npm WARN
2022-02-22T06:24:10.854Z [INFO]: deprecated [email protected]: 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.
2022-02-22T06:24:10.855Z [INFO]: npm
2022-02-22T06:24:10.855Z [INFO]: WARN deprecated [email protected]: 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.
2022-02-22T06:24:10.858Z [INFO]: npm
2022-02-22T06:24:10.858Z [INFO]: WARN deprecated [email protected]: 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.
2022-02-22T06:24:10.930Z [INFO]: npm
2022-02-22T06:24:10.930Z [INFO]: WARN deprecated @graphql-toolkit/[email protected]: 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.
2022-02-22T06:24:10.941Z [INFO]: npm WARN
2022-02-22T06:24:10.942Z [INFO]: deprecated @graphql-toolkit/[email protected]: 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.
2022-02-22T06:24:10.984Z [INFO]: npm WARN
2022-02-22T06:24:10.984Z [INFO]: deprecated [email protected]: 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.
2022-02-22T06:24:13.589Z [INFO]: npm
2022-02-22T06:24:13.591Z [INFO]: WARN deprecated @graphql-toolkit/[email protected]: 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.
2022-02-22T06:24:26.289Z [INFO]: npm WARN deprecated @aws-amplify/[email protected]: This version is no longer supported. Please use 7.6.15 or higher.
2022-02-22T06:24:27.452Z [INFO]: npm WARN deprecated [email protected]: core-js@<3.4 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.
2022-02-22T06:24:27.453Z [INFO]: npm
2022-02-22T06:24:27.453Z [INFO]: WARN deprecated [email protected]: core-js@<3.4 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.
2022-02-22T06:24:27.454Z [INFO]: npm
2022-02-22T06:24:27.454Z [INFO]: WARN deprecated [email protected]: core-js@<3.4 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.
2022-02-22T06:24:33.552Z [INFO]: npm
2022-02-22T06:24:33.556Z [INFO]: ERR! code 127
                                 npm ERR! path /root/.nvm/versions/node/v16.14.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
                                 npm ERR! A complete log of this run can be found in:
                                 npm ERR!     /root/.npm/_logs/2022-02-22T06_22_14_753Z-debug-0.log
2022-02-22T06:24:33.611Z [INFO]: ! Error patching NPM package '@aws-amplify/cli' to version 7.6.13
2022-02-22T06:24:33.623Z [INFO]: # Retrieving cache...
2022-02-22T06:24:45.684Z [INFO]: # Extracting cache...
2022-02-22T06:24:48.255Z [INFO]: # Extraction completed

martinburger avatar Feb 22 '22 14:02 martinburger

oh, sorry it didn't work! AWS swallows some logs so we never know what actually is going wrong behind the scenes. can you try doing a clean install if you're not doing it already? using npm ci instead of npm install in prebuild stage. also, you can try resetting env cache, idk if it helps but something better than nothing right?

also, from the first few lines

2022-02-22T06:22:13.439Z [WARNING]: Cannot find module '/root/.nvm/versions/node/v16.14.0/lib/node_modules/@aws-amplify/cli/package.json'
                                    Require stack:
                                    - /snapshot/AWSMobilePioneerExecute/src/plugins/patch/npm.js
                                    - /snapshot/AWSMobilePioneerExecute/src/plugins/patch/patch.js
                                    - /snapshot/AWSMobilePioneerExecute/pioneer.js

I'm guessing that it is having some issues finding the amplify-cli module or something to do with package.json. no clue if its some server-side issue or client-side, but I have come across that even renaming a letter of the filename is causing drastic build errors in amplify. so maybe try rebuilding every dependency at the client-side and doing amplify push etc. or if feasible, recreating the backend environment as the last resort.

AniketKariya avatar Feb 22 '22 17:02 AniketKariya

I am also facing this issue. Currently looking at using a custom image to rule out if maybe something is off with the live update to latest. Interestingly, if I work back from version 7.6.21 it eventually started to fail at a amplify --version instead of amplifyPush --simple -- with the same feature flags config error. I tried all versions of node as well with no luck.

oste avatar Feb 22 '22 22:02 oste

I am also facing this issue. Currently looking at using a custom image to rule out if maybe something is off with the live update to latest. Interestingly, if I work back from version 7.6.21 it eventually started to fail at a amplify --version instead of amplifyPush --simple -- with the same feature flags config error. I tried all versions of node as well with no luck.

You find sections backend and frontend of my applications's configuration file below. I added some commands to verify the Amplify and the Node.js version, respectively.

version: 1
backend:
  phases:
    preBuild:
      commands:
        - node --version
        - amplify --version
    build:
      commands:
        - amplifyPush --simple
frontend:
  phases:
    preBuild:
      commands:
        - node --version
        - npm ci
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: build
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

Now, the backend build fails already at command amplify --version in phase preBuild:

                                 # Starting phase: preBuild
                                 # Executing command: node --version
2022-02-22T13:25:56.374Z [INFO]: v17.5.0
                                 # Executing command: amplify --version
2022-02-22T13:25:59.450Z [INFO]: [31mInvalid feature flag configuration[39m
[...]

martinburger avatar Feb 23 '22 06:02 martinburger

can you try doing a clean install if you're not doing it already? using npm ci instead of npm install in prebuild stage.

Thanks for the hint. I use npm in the frontend section only:

version: 1
backend:
  phases:
    preBuild:
      commands:
        - node --version
        - amplify --version
    build:
      commands:
        - amplifyPush --simple
frontend:
  phases:
    preBuild:
      commands:
        - node --version
        - npm ci
# [...]

And, I already use npm ci to install packages.

martinburger avatar Feb 23 '22 06:02 martinburger

also, you can try resetting env cache, idk if it helps but something better than nothing right?

I did that as well:

version: 1
backend:
  phases:
    preBuild:
      commands:
        # https://github.com/aws-amplify/amplify-console/issues/2552#issuecomment-1048038009
        - envCache --set stackInfo ""
        - node --version
        - amplify --version
    build:
      commands:
        - amplifyPush --simple
# [...]

To no avail as well:

                                 # Starting phase: preBuild
                                 # Executing command: envCache --set stackInfo ""
2022-02-23T06:31:46.827Z [INFO]: # Executing command: node --version
2022-02-23T06:31:46.830Z [INFO]: v17.6.0
2022-02-23T06:31:46.830Z [INFO]: # Executing command: amplify --version
2022-02-23T06:31:49.972Z [INFO]: [31mInvalid feature flag configuration[39m

martinburger avatar Feb 23 '22 06:02 martinburger

I just tried to update global package @aws-amplify/cli in my build script:

version: 1
backend:
  phases:
    preBuild:
      commands:
        - node --version
        - npm update -g @aws-amplify/cli
        - amplify --version
    build:
      commands:
        - amplifyPush --simple
# [...]

Both, with overriding Amplify CLI to latest and without overriding that package, same result:

                                 # Starting phase: preBuild
                                 # Executing command: node --version
2022-02-23T06:47:12.903Z [INFO]: v17.6.0
                                 # Executing command: npm update -g @aws-amplify/cli
2022-02-23T06:47:15.125Z [INFO]: changed 1 package, and audited 220 packages in 2s
2022-02-23T06:47:15.125Z [INFO]: 11 packages are looking for funding
                                 run `npm fund` for details
2022-02-23T06:47:15.127Z [INFO]: 3 moderate severity vulnerabilities
                                 To address all issues, run:
                                 npm audit fix
                                 Run `npm audit` for details.
2022-02-23T06:47:15.133Z [INFO]: # Executing command: amplify --version
2022-02-23T06:47:18.307Z [INFO]: [31mInvalid feature flag configuration[39m

So, although it seems that package @aws-amplify/cli had been updated, the backend build still failed with the same Invalid feature flag configuration error. Well, I've run out of ideas.

BTW, without overriding Amplify CLI, the Cannot find module ... error while cloning the repository doesn't occur.

martinburger avatar Feb 23 '22 06:02 martinburger

updating amplify cli helped for me sudo npm i -g @aws-amplify/cli

donalbertico avatar Feb 23 '22 14:02 donalbertico

updating amplify cli helped for me sudo npm i -g @aws-amplify/cli

In my case, using sudo causes the following error:

                                 # Starting phase: preBuild
                                 # Executing command: sudo npm install -g @aws-amplify/cli
2022-02-23T15:07:08.231Z [WARNING]: /codebuild/output/src803801990/src/erlebe-salsa-website/amplify.sh: line 5: sudo: command not found
2022-02-23T15:07:08.231Z [ERROR]: !!! Build failed
2022-02-23T15:07:08.231Z [ERROR]: !!! Non-Zero Exit Code detected
2022-02-23T15:07:08.232Z [INFO]: # Starting environment caching...
2022-02-23T15:07:08.232Z [INFO]: # Uploading environment cache artifact...
2022-02-23T15:07:08.334Z [INFO]: # Environment caching completed
Terminating logging...

Thus, sudo seems to be unavailable.

martinburger avatar Feb 23 '22 15:02 martinburger

I'm also facing the same issue, using version 7.6.21.

Tried a few things today, and this is what worked for me:

Mainly: - nvm use $VERSION_NODE_16 (under build, prebuild) - npm install aws-amplify (under build)

version: 1
backend:
  phases:
    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
        - nvm use $VERSION_NODE_16
        - npm install aws-amplify
        - amplify --version
        - npm install --silent --global expo-cli
        - |-
          if [ -f yarn.lock ]; then
           yarn
          elif [ -f package-lock.json ] || [ -f npm-shrinkwrap.json ]; then
           npm ci
          else
           npm install
          fi
          
    build:
      commands:
        - nvm use $VERSION_NODE_16
        - 'expo build:web'
  artifacts:
    baseDirectory: web-build
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*
      - $(npm root --global)/**/*

Only the following build override applied, matching my amplify CLI version on my machine: Amplify CLI 7.6.21

ritika2291 avatar Feb 23 '22 18:02 ritika2291

adding to backend build commands npm i -g @aws-amplify/cli did up being a valid workaround for me.

oste avatar Feb 26 '22 02:02 oste