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

Generate Backend API Models FAILED, Reason: Transform GraphQL schema file not found.

Open duranmla opened this issue 2 years ago • 5 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.
  • [X] I have removed any sensitive information from my code snippets and submission.

How did you install the Amplify CLI?

npm

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

16.16.0

Amplify CLI Version

9.2.0

What operating system are you using?

Mac

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

I haven't made manual changes to the cloud resources for this scenario.

Amplify Categories

api

Amplify Commands

push

Describe the bug

I use to have my schema.graphql as a single file with all models, in a recent effort to make this file more modular I realise there is built in support to split the GraphQL schemas: https://docs.amplify.aws/cli-legacy/graphql-transformer/overview/#rebuild-graphql-api from legacy docs and a hint on latest docs https://docs.amplify.aws/cli/graphql/overview/#creating-your-first-table

Once I do that everything seems to be working fine as I made the changes and no data/table has been attempted to be deleted, besides, I have tried to remove/add attributes on a model and everything seems to work fine. Problem is that when I amplify push everything is green until I have:

Failed to create models in the cloud: Modelgen job creation failed
✔ All resources are updated in the cloud

Just at the end of the push process. Besides, when I take a look to the Amplify studio I see under "Deployment activity":

Generate Backend API Models, status FAILED, reason "Transform GraphQL schema file not found."

Worth to mention that after the changes I do after porting schema to different files I see a correct behaviour in terms of amplify status detecting no changes after the push and types are being updated, if it wasn't for that error I think I not even notice there might be a problem

Expected behavior

I would have expected that upon the changes I made all the terminal output pass without errors.

Reproduction steps

  1. Create an environment using a single schema.graphql file
  2. Push all to the cloud
  3. Port individual models into separate files under amplify/backend/api/<app>/schema folder
  4. Remove the schema.graphql file
  5. Push all to the cloud

GraphQL schema(s)

No response

Project Identifier

Project Identifier: 3ca55ec3069b93de14b32939201a5621

Log output

amplify-cli-2022-08-04.log

Additional information

No response

duranmla avatar Aug 04 '22 14:08 duranmla

Bump

brienpafford avatar Sep 08 '22 18:09 brienpafford

Hey @duranmla :wave: thanks for raising this and apologies for the delay! I was able to reproduce this issue using the following steps:

  1. create an app with amplify init -y
  2. add a GraphQL API with DataStore enabled, amplify add api
  3. delete the schema.graphql file and create a sample Todo.graphql file in the schema/ directory
    type Todo @model {
      name: String!
    }
    
  4. push with amplify push -y
  5. enable Amplify Studio through the Hosting console
  6. pull into a fresh sibling directory ../myapp2
  7. make some change to the API and push
  8. observe Failed to create models in the cloud: Modelgen job creation failed

josefaidt avatar Sep 08 '22 20:09 josefaidt

I didn't notice the notification, thanks for dive into this @josefaidt I bet it is a lot of effort going through everything in this repo. Kind regards. I have moved forward with the unique schema file but I am thrill for this 👋

duranmla avatar Sep 19 '22 12:09 duranmla

What's the latest with this? Facing the same issue, nothing shows up in Amplify Studio if I use split files.

joeykay9 avatar May 14 '24 19:05 joeykay9

Are you seeing this error with the latest CLI (12.12.0)?

dpilch avatar May 15 '24 15:05 dpilch