apollo-kotlin icon indicating copy to clipboard operation
apollo-kotlin copied to clipboard

Display error message from server on introspection errors

Open sproctor opened this issue 8 months ago • 2 comments

Use case

When Supabase encounters a malformed comment, it returns an error to introspection requests. It would be nice to see that error.

Describe the solution you'd like

Currently when the server has an error, ./gradlew downloadServiceApolloSchemaFromIntrospection displays this message:

java.lang.Exception: Introspection response from http://127.0.0.1:54321/graphql/v1 can not be parsed

The response from the server was:

{
  "data": null,
  "errors": [
    {
      "message": "invalid input syntax for type json"
    }
  ]
}

In that case, it would be nice if Apollo gracefully handled the error and displayed the message from the server.

sproctor avatar Mar 11 '25 14:03 sproctor

We could certainly improve the message. Passing --stacktrace to the gradle invocation does show more info but only the first 50 characters of the received document are shown.

BoD avatar Mar 11 '25 14:03 BoD

Thanks! I did run it with --stacktrace, but I didn't notice that the message was actually in the output.

sproctor avatar Mar 11 '25 15:03 sproctor

@sproctor https://github.com/apollographql/apollo-kotlin/pull/6590 displays a small hint that there is more information in the rest of the stacktrace. Hopefully that will make it easier to parse the output. Let us know what you think!

martinbonnin avatar Jun 27 '25 10:06 martinbonnin