There is a service which only contains a mutation which has only input types defined:
extend type Mutation {
addSurveyResult(result: SurveyResult!): ID
}
input SurveyResultTuple {
key: String
value: String
}
input SurveyResult {
userId: ID!
type: String!
elements: [SurveyResultTuple!]!
}
when I try to federate the service by a gateway the following errors occure:
Service:
unknown field "_service"
goroutine 9 [running]:
runtime/debug.Stack(0x1, 0x0, 0x0)
/usr/local/go/src/runtime/debug/stack.go:24 +0x9d
runtime/debug.PrintStack()
/usr/local/go/src/runtime/debug/stack.go:16 +0x22
github.com/99designs/gqlgen/graphql.DefaultRecover(0xc0c740, 0xc0002c8690, 0x9fe620, 0xc0001b8de0, 0x44900f, 0x18)
/home/simon/go/pkg/mod/github.com/99designs/[email protected]/graphql/recovery.go:16 +0xa7
github.com/99designs/gqlgen/graphql/handler.(Server).ServeHTTP.func1(0xc0000d5e40, 0xc00013fbd0, 0xc0ae40, 0xc0002922a0)
/home/simon/go/pkg/mod/github.com/99designs/[email protected]/graphql/handler/server.go:124 +0xa7
panic(0x9fe620, 0xc0001b8de0)
/usr/local/go/src/runtime/panic.go:679 +0x1b2
recommender-survey-archive/cmd/graph/generated.(executionContext)._Query(0xc0001b8da0, 0xc0c740, 0xc0002c8ff0, 0xc0001b8b40, 0x1, 0x1, 0x40dcc6, 0xc0002c8fc0)
/home/simon/go/src/recommender-survey-archive/cmd/graph/generated/generated.go:1527 +0x6b4
recommender-survey-archive/cmd/graph/generated.(executableSchema).Exec.func1(0xc0c740, 0xc0002c8fc0, 0x10)
/home/simon/go/src/recommender-survey-archive/cmd/graph/generated/generated.go:99 +0x7b
github.com/99designs/gqlgen/graphql/handler.executor.DispatchOperation.func1.1.1(0xc0c740, 0xc0002c8fc0, 0xc0001b8db0)
/home/simon/go/pkg/mod/github.com/99designs/[email protected]/graphql/handler/executor.go:100 +0x43
github.com/99designs/gqlgen/graphql/handler.newExecutor.func2(0xc0c740, 0xc0002c8fc0, 0xc0001b8db0, 0xbeec60)
/home/simon/go/pkg/mod/github.com/99designs/[email protected]/graphql/handler/executor.go:33 +0x3a
github.com/99designs/gqlgen/graphql/handler.executor.DispatchOperation.func1.1(0xc0c740, 0xc0002c8f60, 0xc0002c8690)
/home/simon/go/pkg/mod/github.com/99designs/[email protected]/graphql/handler/executor.go:99 +0x130
github.com/99designs/gqlgen/graphql/handler/transport.POST.Do(0xc0ae40, 0xc0002922a0, 0xc00028e300, 0xc0b300, 0xc0000c0ff0)
/home/simon/go/pkg/mod/github.com/99designs/[email protected]/graphql/handler/transport/http_post.go:52 +0x353
github.com/99designs/gqlgen/graphql/handler.(Server).ServeHTTP(0xc0000d5e40, 0xc0ae40, 0xc0002922a0, 0xc00028e300)
/home/simon/go/pkg/mod/github.com/99designs/[email protected]/graphql/handler/server.go:140 +0x23c
net/http.(ServeMux).ServeHTTP(0x106d9c0, 0xc0ae40, 0xc0002922a0, 0xc00028e200)
/usr/local/go/src/net/http/server.go:2387 +0x1bd
net/http.serverHandler.ServeHTTP(0xc0002921c0, 0xc0ae40, 0xc0002922a0, 0xc00028e200)
/usr/local/go/src/net/http/server.go:2802 +0xa4
net/http.(conn).serve(0xc000270b40, 0xc0c680, 0xc000290b00)
/usr/local/go/src/net/http/server.go:1890 +0x875
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2928 +0x384
Gateway:
Encountered error when loading recommender-survey-archive at http://localhost:4004/query: 422: Unprocessable Entity
When the following graphql type is added everything works smoothly
type Workaround @key(fields: "id") {
id: Int
}
Note: @key is required for this workaround
I don't understand the details but I would expect gqlgen to add the following Query without the Workaround type, so that the service can be federated:
extend type Query {
_entities(representations: [_Any!]!): [_Entity]!
_service: _Service!
}
See above.
gqlgen version? v0.11.1
go version?go version go1.13.6 linux/amd64
EDIT: Btw. I want to thank you for providing a go lib that allows to federate with apollo. You have created a really smooth technology that helps me a lot, great job and thank you!
Same issue here.
That cost me nearly an hour to debug :sweat: always thought I fucked up somehow.
I'm having the same issue,
gqlgen version is v0.11.2
@apollo/gateway: 0.13.2
@BitPhinix how did you solve it? Even the Todo example isn't working for me.
@yarinm, I solved it by adding an dummy entity to the serivce (It isn't referenced by any query / mutation)
Any update with this? I'm having the same problem.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I would suggest to keep this open.
The same issue here. any news?
The workaround @aaad suggested works (ty, btw) but would be great if we could have a more permanent solution!
Most helpful comment
The same issue here. any news?