graphql / graphiql

GraphiQL & the GraphQL LSP Reference Ecosystem for building browser & IDE tools.
MIT License
16.12k stars 1.73k forks source link

LSP Server config doesn't work with customFetch #2018

Open madeleineostoja opened 3 years ago

madeleineostoja commented 3 years ago

Actual Behavior

When using a remote schema (with a custom fetch in my case) autocomplete fails silently. When I generate a schema from introspection from that same schema definition with graphql-cli and use that, autocomplete works again.

My config (for Prismic

schema:
  https://heybokeh.cdn.prismic.io/graphql:
    customFetch: 'codegen-prismic-fetch'
documents: './src/**/*.{graphql,ts,tsx}'
...

Expected Behavior

This extension should work with remote schemas defined in graphql config

Steps to Reproduce the Problem Or Description

  1. Specify remote schema with custom fetch in graphql config
  2. Try write queries, see that autcomplete doesn't work

Specifications

acao commented 2 years ago

does this issue appear to be resolved in the latest release?

madeleineostoja commented 2 years ago

I just tested it again and yep it's still an issue

acao commented 2 years ago

The issue is with customFetch. Is that from graphql mesh config or something? We need to look up where these customFetch configs come from

madeleineostoja commented 2 years ago

Ah okay, thought it was part of the standard. It's used by a few tools, namely graphql-codegen and graphql-cli (I assume via graphql mesh). A custom fetch is needed for Prismic (in my case) because you need to get a ref from its API to set in a header for the actual request.

For now a perfectly acceptable workaround is generating a JSON schema through introspection and pointing GraphQL config to that instead.

acao commented 2 years ago

Sorry about that, sounds less than ideal :/

I don't see any reference to customFetch in graphql-config, so it must have to do with UrlLoader or something else in graphql-tools? Will have to add this to the roadmap