GraphQL Router / API Gateway framework written in Golang, focussing on correctness, extensibility, and high-performance. Supports Federation v1 & v2, Subscriptions & more.
The bug seems to occur when I have an interface, and it is implemented and then extended by another service. If we try to fetch a field which was extended, but there is no data exists which includes that field.
We get an error Get \"\": unsupported protocol scheme \"\".
Version
github.com/wundergraph/graphql-go-tools v1.67.2
Background
The repository, linked above, creates a minimal example to try to replicate a bug. I am noticing occurs with service(s) when I use federation.
Explanation
Let's have a look at an example, which may better explain the issue we are noticing (in this repository).
NOTE: When I say graphql gateway this is the service I built which uses this library.
This is when the error is thrown by the GraphQL gateway. Where this library is used. Looking at the error thrown by the GraphQL gateway (which is using this library) I see:
Get \"\": unsupported protocol scheme \"\"
Where the error is thrown when we call Execute function on ExecutionEngineV2. The relevant code in our GraphQL gateway looks like so (this is HTTP handler function):
From what I can see, the error happens within the method resolveObject in pkg/engine/resolve/resolve.go.
I noticed that this part (the error, and a null is returned) of the code is being called pkg/engine/resolve/inputtemplate.go in the Render method.
if errors.Is(err, setTemplateOutputNull) {
preparedInput.Reset()
preparedInput.WriteBytes(literal.NULL)
return nil
}
Where the error is set in this case:
case ObjectVariableKind:
err = i.renderObjectVariable(ctx.Context(), data, segment, preparedInput)
Reproduce
Start up both services in this repository
cd servicea
PORT=8095 go run server.go
# In another terminal
cd serviceb
PORT=8096 go run server.go
Point your GraphQL gateway to these services, i.e. http://localhost:8095/query, to enable federation.
Hi :wave:,
I think I have come across a bug in this library (please let me know if I am missing something and this is not the case).
Example Repository: https://gitlab.com/haseeb.majid1/graphql-minimal
TL;DR;
The bug seems to occur when I have an interface, and it is implemented and then extended by another service. If we try to fetch a field which was extended, but there is no data exists which includes that field.
We get an error
Get \"\": unsupported protocol scheme \"\"
.Version
Background
The repository, linked above, creates a minimal example to try to replicate a bug. I am noticing occurs with service(s) when I use federation.
Explanation
Let's have a look at an example, which may better explain the issue we are noticing (in this repository).
In this example defined in
servicea
:Then we have several implementations of that interface defined like so:
Then in another service, say
serviceb
, we extend one of these implementations like so:If we send a query to see which types exist:
Which returns:
As we can see, we only have types of
UserItemB
. When we send a query to get thereason
:This is when the error is thrown by the GraphQL gateway. Where this library is used. Looking at the error thrown by the GraphQL gateway (which is using this library) I see:
Where the error is thrown when we call
Execute
function onExecutionEngineV2
. The relevant code in our GraphQL gateway looks like so (this is HTTP handler function):Where the engine is of type:
Code in Library
From what I can see, the error happens within the method
resolveObject
inpkg/engine/resolve/resolve.go
. I noticed that this part (the error, and a null is returned) of the code is being calledpkg/engine/resolve/inputtemplate.go
in theRender
method.Where the error is set in this case:
Reproduce
http://localhost:8095/query
, to enable federation.Please let me know if you need additional information! Happy to help where I can.
Thanks