Amplify-cli: Resolvers in src/graphql not updating correctly on amplify push

Created on 9 Mar 2019  路  12Comments  路  Source: aws-amplify/amplify-cli

* Which Category is your question related to? *
API, GraphQL

* What AWS Services are you utilizing? *
amplify cli, S3, DynamoDB, GraphQL, Cognito

* Provide additional details e.g. code snippets *
I'm currently running version 1.1.7 of the amplify CLI.

I made a change to the graphql.schema and did amplify push but the files in src/graphql are not being updated to reflect that I removed a @model declaration. Is there a way to force rebuild those? Doing amplify api gql-compile does not do it. To be clear, mutations.js, queries.js, subscriptions.js and schema.json are all unchanged. My expectation is that they would be updated automatically whenever a change in graphql.schema is pushed.

I also just added a new model to my schema.grapql file, did amplify push, all of the services were updated with the new model but the files in src/graphql were not updated to reflect this change.

Is there a way to force this to happen?

code-gen pending-close-response-required question

Most helpful comment

Sorry, I missed that request. Yes, when I deleted .graphqlconfig.yml and did amplify codegen add it did start generating the code again on the next push. Thanks!

All 12 comments

@kaustavghosh06, this is the new issue that you asked me to create from the question in #992.
thanks.

OK - I found amplify add codegen --apiId so that solves my problem. My question is why that isn't automatically running when I make changes, I think it did previously.

Is graphql.schema also reverting itself to the previous schema after amplify push?

do you mean schema.graphql? It is not.

Yes, sorry. I was experiencing a similar issue, but the actual schema file itself reverted also (which led to me rewriting the same schema a couple of times before I realized what was happening lol). What is your development platform, Linux, Windows, WSL?

I'm developing on Mac

@poppybank could you share your <project-root>/.graphqlconfig.yml file. Please redact sensitive info before sharing them.

Also when you do a push do you get asked if you want to generate code?

@yuth I do not get asked if I want to generate code on a push.

Here's the .graphqlconfig.yml file.


projects:
  tweedcaseapi-dev:
    schemaPath: src/graphql/schema.json
    includes:
      - src/graphql/**/*.js
    excludes:
      - ./amplify/**
    extensions:
      amplify:
        graphQLApiId: <xxxx>
        codeGenTarget: javascript
        generatedFileName: ''
        docsFilePath: src/graphql
        region: us-west-2
        maxDepth: 3
      endpoints:
        prod: >-
          https://<xxx>.appsync-api.us-west-2.amazonaws.com/graphql


@poppybank is this .graphqlconfig.yml after you did amplify add codegen --apiId. If thats the case could you delete .graphqlconfig.yml the file and then run amplify codegen add and see the codegen happens when you push after that

Closing this issue due to lack of requester response. Please feel free to re-open if you're still seeing this issue.

Sorry, I missed that request. Yes, when I deleted .graphqlconfig.yml and did amplify codegen add it did start generating the code again on the next push. Thanks!

This helped us, thanks a bunch!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ffxsam picture ffxsam  路  3Comments

nicksmithr picture nicksmithr  路  3Comments

ReidWeb picture ReidWeb  路  3Comments

onlybakam picture onlybakam  路  3Comments

nason picture nason  路  3Comments