Skip to content
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

Remote Schemas refresh issue #4921

Closed
samuelcastro opened this issue May 28, 2020 · 6 comments
Closed

Remote Schemas refresh issue #4921

samuelcastro opened this issue May 28, 2020 · 6 comments
Labels
c/remote-schemas Issues related to Remote Schemas k/question

Comments

@samuelcastro
Copy link

I'm facing an weird issue with remote schemas, I have a remote schema in a headless CMS (GraphCMS) and usually the schema changes quite often, the problem that I'm facing is that once I changed the schema on GraphCMS those changes are not reflected on Hasura, they old schemas are still preserved somehow, it looks like some sort of cache or something.

Thoughts?

Thanks.

@samuelcastro
Copy link
Author

samuelcastro commented May 28, 2020

I just found a reload button in the remote schemas pages and now it's working, but that changes how I initially thought remote schemas worked, so my questions are:

  • Isn't it somehow live "connected" with the remote endpoint?
  • if we need to constantly "reload" remote schemas, how can we automate this process?
  • And maybe isn't there a way to always return the latest remote schema or "reload" it under the hood anytime the resource is going to be used?

Thanks!

@GeKorm
Copy link
Contributor

GeKorm commented May 28, 2020

Although I don't know the reasoning behind caching the schema (I imagine performance and reliability) I think this section in the documentation has some answers https://hasura.io/docs/1.0/graphql/manual/remote-schemas/index.html#schema-refreshing

@samuelcastro
Copy link
Author

Ok thanks @GeKorm this is what I needed to know, more specifically, how to programatically reload remote schemas: https://hasura.io/docs/1.0/graphql/manual/api-reference/schema-metadata-api/remote-schemas.html#reload-remote-schema

But it would be nice to know the reasons behind this strategy.

From documentation:

From v1.0.0-beta.3 onwards, a remote server’s GraphQL schema is cached and refreshed only when user explicitly reloads remote schema by clicking the Reload button on the console or by making a reload_remote_schema metadata API request

@rikinsk rikinsk added c/remote-schemas Issues related to Remote Schemas k/question labels Jun 3, 2020
@rikinsk rikinsk changed the title Remote Schemas issue Remote Schemas refresh issue Jun 3, 2020
@rikinsk
Copy link
Member

rikinsk commented Jun 3, 2020

@samuelcastro This was done to improve performance. Reloading remote schema everytime the metadata changes starts having performance impacts if you have lots of remote schemas or have very large remote schemas. As in most cases metadata change are due to updates to the database schema or other configuration such as relationships or permissions, it is wasteful to keep refreshing the data from remote schemas on every change. Hope this makes sense.

@samuelcastro
Copy link
Author

samuelcastro commented Jun 5, 2020

Ok @rikinsk it makes more sense now. Thanks!

@samuelcastro
Copy link
Author

samuelcastro commented Jan 21, 2021

Hi @rikinsk Is there a way to reload schemas from Hasura CLI?

Does Hasura Metada Reload also reloads remote schemas? https://hasura.io/docs/1.0/graphql/core/hasura-cli/hasura_metadata_reload.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/remote-schemas Issues related to Remote Schemas k/question
Projects
None yet
Development

No branches or pull requests

3 participants