Skip to content

Introspection Query Parse Error with Apollo GraphQL Schema Download #6327

Open
@kibitheM

Description

Question

Hello There,

I'm encountering an issue while attempting to download a schema from my GraphQL endpoint using Apollo. I am working on integrating Apollo GraphQL with a Supabase project. Here's the configuration I'm using in my build.gradle.kts file:

apollo {
    service("service") {
        packageName.set("com.ngumi.app")
        srcDir("src/main/graphql")

        introspection {
            endpointUrl.set("https://peclvhlyxzwmegdkhtvj.supabase.co/graphql/v1
")
            headers.put("apikey", "<my-api-key>")
        }
         codegenModels.set("operationBased")
    }
}


When I run the following Gradle task:

./gradlew downloadApolloSchema

Bash
It fails with the following error:

Execution failed for task ':app:downloadApolloSchema'.
> java.lang.Exception: Introspection response from [https://<your-supabase-endpoint>](https://peclvhlyxzwmegdkhtvj.supabase.co/graphql/v1).supabase.co/graphql/v1 can not be parsed
Use code [with caution](https://support.google.com/legal/answer/13505487).
Debugging Steps Taken
To investigate further, I directly fetched the introspection query response from the server using Invoke-WebRequest in PowerShell. Here's the response I received:

{
    "errors": [
        {
            "message": "query parse error: Parse error at 1:787\nUnexpected `}[Punctuator]`\nExpected `end of input`\n"
        }
    ]
}


I also used the Apollo sandbox to run the introspection query, and it was successful and returned a full schema.

Additional Context
The GraphQL endpoint is functional, as I've successfully executed other queries through Postman and the Apollo sandbox.

The parse error suggests that there is an unexpected } character at the end of the introspection query being sent (Based on the error provided by my supabse endpoint).

Running the Gradle task with --info and --debug did not provide additional clarity beyond pointing to the parse error.

Questions
Is it possible that the introspection query generated by Apollo is malformed, or it is not compatible with the version of the GraphQL server that my Supabase endpoint is using? If so, where can I adjust it?

Are there any known issues with Apollo's handling of introspection queries on Supabase-hosted GraphQL endpoints?

Is there a way to customize or manually supply the introspection query used by Apollo? Or an alternative approach to downloading a schema when introspection is not possible?

I appreciate any help or guidance the team can provide! Please let me know if additional information is needed.

Thank you in advance for your support!

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions