amplify-studio
amplify-studio copied to clipboard
Generate Backend API Models FAILED, Reason: Transform GraphQL schema file not found.
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
- Create an environment using a single
schema.graphql
file - Push all to the cloud
- Port individual models into separate files under
amplify/backend/api/<app>/schema
folder - Remove the
schema.graphql
file - Push all to the cloud
GraphQL schema(s)
No response
Project Identifier
Project Identifier: 3ca55ec3069b93de14b32939201a5621
Log output
Additional information
No response
Bump
Hey @duranmla :wave: thanks for raising this and apologies for the delay! I was able to reproduce this issue using the following steps:
- create an app with
amplify init -y
- add a GraphQL API with DataStore enabled,
amplify add api
- delete the
schema.graphql
file and create a sampleTodo.graphql
file in theschema/
directorytype Todo @model { name: String! }
- push with
amplify push -y
- enable Amplify Studio through the Hosting console
- pull into a fresh sibling directory
../myapp2
- make some change to the API and push
- observe
Failed to create models in the cloud: Modelgen job creation failed
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 👋
What's the latest with this? Facing the same issue, nothing shows up in Amplify Studio if I use split files.
Are you seeing this error with the latest CLI (12.12.0
)?