-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[request?] amplify codegen
does not reflect updated schema from local copy
#113
Comments
amplify push
run codegen before updating cloudformation to reduce super long wait timeamplify codegen
does not reflect updated schema
amplify codegen
does not reflect updated schemaamplify codegen
does not reflect updated schema from local copy
The main reason for this is that the new schema is not compiled. A temporary solution is to run |
If I run the indicated commands, it still doesn't seem to update the generated code in src/graphql although the compile step does seem to know about the changes - just codegen doesn't do anything as far as I can tell. |
Re-opening as we are reconsidering the implementation. As of now the current workaround when making schema changes, you can run |
@SwaySway Hi Josue. Any progress on this subject, as with latest version of Amplify (namely 4.41.0), nothing is generated/updated in |
@binadamu-isiyoonekana |
I made some tries with the mock, creating news tables, and looking at the same time what is happening in the mutation.js file. It happens that at some point during the code génération the code of the new tables is created, but it's removed right away, I don't know why. At this point the new code is created : This is all the things I have in my console : But apparently removing the Btw removing, or reinstalling codegen didn't change anything |
This workaround you proposed does not seems to work. .graphqlconfig.yml
schema tested:
|
A little update:
Noticed that Afterwards, I ran |
Hi All, Thanks for keeping this updated and re-raising 🙌🏻 . The team is looking into this now to determine the best path forward, and will update this as soon as there is more information. Just an fyi - this will be transferred over to the Thanks again! |
Is there a fix or some workaround for this? I'm still facing this issue. |
|
The workaround is to re-compile your updated schema as mentioned here: #113 (comment) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because of inactivity. Please open a new issue if you are still encountering problems. |
Why in the name of all that is holy, do I need to use |
To take it one step further, why not: "amplify api gql-compile && amplify codegen && amplify codegen models" instead of just "amplify codegen". Also, this workaround should probably be entered in the docs somewhere. |
After doing all those latest answer with new scripts, the model which are renamed in the cloud didn't get synced to the local JS files. All models created are synced but the existing models renamed are not replaced. |
Three and a half YEARS later and the behavior is still not like the docs... At least the mentioned workaround does the trick sometimes. |
And what do you do if you split your graphql models into multiple files? amplify api gql-compile && amplify codegen does not work in that case. In that case I need to amplify push and only then I get codegen to work. I feel I am opening tickets regarding bad amplify behavior 3 times a week. |
Is your feature request related to a problem? Please describe.
Problem 1: codegen doesnt codegen from local copy
when i update my local schema in
/amplify/backend/api/MYAPI/schema.graphql
and runamplify codegen
, the generated code insrc/graphql
doesn't update at all.we are not sure if this is a bug or working as intended. but it's clear that in order to update the generated code i have to
amplify push
.Problem 2: CLI gives the impression that codegen is done before push
I have to
amplify push
before i cancodegen
the new model:this causes a LONG wait time and completely breaks my flow, for information i already have on my machine.
I ran
amplify push
40 minutes1 hour ago and am still waiting for my updated graphql schema so i can continue working. this is not a sustainable workflow when i'm just changing one little field on my schema.Repro steps
amplify add api
amplify codegen
amplify codegen
againsrc/graphql
Describe the solution you'd like
i understand you do this in order to always codegen the right thing. but perhaps offer to codegen based off my local model first, if i accept the risks of mismatch between the model i have on my machine and the model i have in the cloud.
Describe alternatives you've considered
do nothing
The text was updated successfully, but these errors were encountered: