3

we have a project repo where backend team have added new apis. other developers have run and configured amplify and codegen. now I want to add these new queries and their types. when I run amplify codegen i get this error:

Please download the schema.graphql or schema.json and place in C:\leag\nevClon\newwebsite before adding codegen when not in an amplify project

and when i run amplify add codegen it says Codegen support only one GraphQL API per project. could someone guide me whats the right way to do that.

4 Answers4

4

I've seen this problem in the past. Things I've tried include ...

  1. Make sure you are in the correct amplify environment.
  2. Run amplify pull to ensure you are up to date.
  3. Try re-initializing using amplify init
  4. When all else fails, try re-cloning the repository.
Alex
  • 952
  • 7
  • 12
2

it's showing that because you still have graphqlconfig.yml file in your src folder, look for the graphqlconfig.yml file and delete it then try again, hopefully it's work this time.

Black-box
  • 21
  • 1
0

In my case I was in wrong backend environment after changing the environment problem was fixed.

Ervis H.
  • 146
  • 6
0

In my case I have to delete the file graphqlconfig.yml in the root of my project enter image description here enter image description here

Then I ran the command again, it was enough to recreate the file properly:

amplify codegen

Ref: https://github.com/aws-amplify/amplify-js/issues/2166#issuecomment-450940562

Junior Grão
  • 1,361
  • 1
  • 8
  • 7