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

How to use more than one remote schema with full error checking? #728

Open
cwilso03 opened this issue Nov 15, 2024 · 0 comments
Open

How to use more than one remote schema with full error checking? #728

cwilso03 opened this issue Nov 15, 2024 · 0 comments

Comments

@cwilso03
Copy link

cwilso03 commented Nov 15, 2024

I'm working on a project that interfaces with Shopify's GraphQL APIs. For those unaware, Shopify has an "Admin" API, accessible via one URL, and a "Storefront" API accessible from a slightly different URL. Each of these APIs has a different schema.

I have configured my graphql.config.yml file to reference each of these endpoints and schemas:

schema:
  - https://mystore.myshopify.com/admin/api/2024-10/graphql.json:
      headers:
        X-Shopify-Access-Token: ${SHOPIFY_ADMIN_API_ACCESS_TOKEN}
  - https://mystore.myshopify.com/api/2024-10/graphql.json:
      headers:
        Shopify-Storefront-Private-Token: ${SHOPIFY_STOREFRONT_API_ACCESS_TOKEN}

I can successfully run introspection queries on each of the schemas.

The problem is that I frequently need to access data from both of the APIs (via separate queries, of course). While this works from a transpiled code standpoint, I see errors in my editor window for the queries of whichever schema I haven't run the introspection on. So, if I run introspection on the Admin API schema, the Storefront queries show errors. And vice-versa if I run the introspection on the Storefront schema.

Is there a way to successfully use both schemas with full error checking, perhaps with an injection along with the #graphql I already put at the top of my query?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant