3

I'm setting up a remote schema inside the other hasura graphql schema how can I set up the reload_remote_schema using node/express js?

I'm facing below problem. Graphql remote schema data is not updating before clicking on the reload button. I don't want to reload remote schema manually, it should refresh automatically via node/express js code.

1 Answers1

5

With any JS http client, you should be able to hit this endpoint:

POST /v1/query HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin

{
    "type": "reload_remote_schema",
    "args": {
        "name": "my remote schema"
    }
}

Documentation: https://docs.hasura.io/1.0/graphql/manual/api-reference/schema-metadata-api/remote-schemas.html#reload-remote-schema

Any time you update your remote schema (e.g. on a new deploy), you can refresh via API.

It's also possible to refresh your remote schemas via CLI: https://docs.hasura.io/1.0/graphql/manual/hasura-cli/hasura_metadata_reload.html#hasura-metadata-reload. But this operation is an exclusive/expensive request (with potential to cause deadlocks as of beta.3 at least).

avimoondra
  • 886
  • 5
  • 9
  • The hasura cli command metadata reload does not reload remote schemas. When making the request `reload_remote_schemas` is not set hence defaults to false and there is no option via cli to set it when making the request – ntziolis Oct 10 '20 at 13:50