amplify-cli: JSONValidationError: File project: data should NOT have additional properties: 'graphqltransformer'

Which Category is your question related to? Amplify, Cognito

Amplify CLI Version Amplify CLI is 4.38.0.

What AWS Services are you utilizing? Amplify, Cognito

Provide additional details e.g. code snippets I get the following error in the amplify console during the CI/CD build

I am not sure how to get the version for the backend build CI/CD. I ran these commands

npm install -g @aws-amplify/cli@latest
amplify configure
amplify init
npm i @aws-amplify/ui-vue

added the following the main.js file (I am using Vue.js for frontend)

import Amplify, { Auth } from 'aws-amplify';
import awsconfig from './aws-exports';
Amplify.configure(awsconfig);

added the following UI components from the auth

<template>
  <amplify-authenticator>
    <div>
      My App
      <amplify-sign-out></amplify-sign-out>
    </div>
  </amplify-authenticator>
</template>

checked out to my dev env removed my previous auth in dev then added a fresh auth with default settings for dev pushed

amplify env checkout dev [--restore]
amplify remove auth
amplify add auth
amplify push

I have a prod env as well and did the same steps for that, but for now, I am testing just the dev branch. I pushed my code to bitbucket and amplify starts provisioning the backend but the build fails.

There are the settings I found in the amplify/.config/project-config.json

{
  "projectName": "MemberPlatform3",
  "version": "3.0",
  "frontend": "javascript",
  "javascript": {
    "framework": "vue",
    "config": {
      "SourceDir": "src",
      "DistributionDir": "dist",
      "BuildCommand": "npm run build",
      "StartCommand": "npm run serve"
    }
  },
  "providers": [
    "awscloudformation"
  ]
}

These are the settings I found in amplify/team-provider-info.json (the auth data comes from the .yml files located in amplify/backend/auth/memberplatform3376d2675.yml)

{
  "dev": {
    "awscloudformation": {
      "AuthRoleName": "xxxxxxxxxxxxxxxxx",
      "UnauthRoleArn": "xxxxxxxxxxxxxxxxx",
      "AuthRoleArn": "xxxxxxxxxxxxxxxxx",
      "Region": "us-west-2",
      "DeploymentBucketName": "xxxxxxxxxxxxxxxxx",
      "UnauthRoleName": "xxxxxxxxxxxxxxxxx",
      "StackName": "xxxxxxxxxxxxxxxxx",
      "StackId": "xxxxxxxxxxxxxxxxx",      
      "AmplifyAppId": "xxxxxxxxxxxxxxxxx"
    },
    "categories": {
      "auth": {
        "memberplatform3376d2675": {}
       }
     }
   },
"prod": {
    // same as above with unique values
    },
    "categories": {
      "auth": {
        "memberplatform36eeced50": {}
       }
     }
   },
}

This is in the amplify/cli.json

{
  "features": {
    "graphqltransformer": {
      "addmissingownerfields": true,
      "validatetypenamereservedwords": true,
      "useexperimentalpipelinedtransformer": false,
      "enableiterativegsiupdates": false
    }
  }
}

Here are my build settings

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: dist
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*
      
backend:
  phases:
    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush -e $AWS_BRANCH --simple

But as you can see in this image from the AWS Amplify Console, any command associated with amplify is failing. I am not sure if I am missing some kind of configuration.

Please help, as I have been trying to figure this out for almost a week now.

Screen Shot 2020-12-08 at 4 13 10 PM

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 28 (2 by maintainers)

Most upvoted comments

Screen Shot 2021-01-05 at 2 34 41 PM

Go to Amplify Click on your amplify app You should see this screen then, Click on build settings, Here you can see your .yml configurations, scroll down and you will find this place where you can edit the input for “Version” or change the CLI

@bradrover @huperniketes

@vikrantRajan within Amplify Console - Advanced Settings you can configure the version of Amplify CLI used for your CI/CD builds: image

I don’t think forcing users to explicitly set the version is a good fix here. Why is the latest version of the cli not… the latest version of the cli? When can we set this back so we’re not managing yet another obscure field that’s likely to break our builds down the line?

I tried both:

  • Set the missing role in General --> Service Role. I created an Amplify Backend Deployment IAM role
  • Set ‘latest’ as Amplify CLI version under Build Settings --> Build image settings --> Edit --> Add package version override --> Select Amplify CLI --> Select version ‘latest’

Only the version-setting worked. Thanks for the help!

@vikrantRajan Please check if you have a pinned down version of the Ampify CLI in Amplify Console, since what is happening is that your Amplify CLI you used to create the project is newer than the one that is running in CI/CD which cause the failure. This error message is already being addressed in #6114.

Please check the setting and make sure you are using LATEST in the Amplify Console as well and not an earlier pinned down version.

@vikrantRajan within Amplify Console - Advanced Settings you can configure the version of Amplify CLI used for your CI/CD builds: image

WHERE is this Advanced Settings page? I don’t see a link to it from any Amplify page, nor can I find it with Google.

In my case I found out that my amplify backend did not have a role attached to it so build was failing. As soon as I added the role with admin access, everything went fine. You can go to the General tab under App settings to see if the role is empty or not

Thanks, I tried everything else in this thread but ultimately this is what fixed the issue for me.

In my case I found out that my amplify backend did not have a role attached to it so build was failing. As soon as I added the role with admin access, everything went fine. You can go to the General tab under App settings to see if the role is empty or not

Seeing this same issue after following the instructions for getting up and running with Amplify here with local amplify version 4.45.0 and remote amplify as whatever the default was (I believe it is for some reason hardcoded as 4.29.0). I had incorrectly assumed that the default was “most recent”, and by looking at the log output of the Provision step in the CICD pipeline I noticed the following line ENV VERSION_AMPLIFY=4.29.4. I added in a rule to use most recent amplify package during build and was able to get it to work (see below - Under Build Settings-> Edit, I added Amplify CLI as Latest version. This fixed my issue.

image

For me this had nothing to do with cli version, or service account. Here are a few tips for new folks like me:

  • if you added hosting to your app as part of a tutorial, it won’t work with a CI build. Remove that with amplify remove hosting.
  • your build Settings->Amplify.yml in the console is probably missing the below. Add it at the top right under version.

backend: phases: build: commands: - ‘# Execute Amplify CLI with the helper script’ - amplifyPush --simple

  • Now is when I started getting all kinds of json validator errors for cli.json. I removed everything in features, so my file looks like this:

{ “features”: { } }

I pretty much have no clue why this file exists and why I had to edit it manually. My CLI version is absolutely up to date and the same as the latest. I did try setting version specifically on the console multiple times and that never worked.

Same as @gyihasz, but I actually had to do both. Left feedback on the mule I was stuck on 😃 this thread was super useful!

@attilah Amplify CLI is 4.38.0.

I can’t run any amplify commands in the backend. Everything is failing when I try to build. It’s working fine locally.

I don’t understand how to edit or check the amplify version in the console. Please help me out with this?