A panic occurs if define type of Subscription
type Subscription implements Node {
id: ID!
userID: ID!
name: String!
deadline: Int!
createdAt: Int!
updatedAt: Int!
}
type Query {
findSubscription(name:String!): Subscription
}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x130447d]
goroutine 1 [running]:
github.com/99designs/gqlgen/codegen/config.(*TypeReference).IsPtr(...)
/Users/foo/go/pkg/mod/github.com/99designs/[email protected]/codegen/config/binder.go:255
github.com/99designs/gqlgen/codegen.(*builder).buildField(0xc0002dd5d0, 0xc000627600, 0xc000167c00, 0x0, 0x1b189e0, 0x0)
/Users/foo/go/pkg/mod/github.com/99designs/[email protected]/codegen/field.go:70 +0x35d
github.com/99designs/gqlgen/codegen.(*builder).buildObject(0xc0002dd5d0, 0xc0001d6900, 0x1618581, 0x6, 0x0)
/Users/foo/go/pkg/mod/github.com/99designs/[email protected]/codegen/object.go:73 +0x4ec
github.com/99designs/gqlgen/codegen.BuildData(0xc0001b8000, 0x16fbc60, 0x1b17d80, 0x0)
/Users/foo/go/pkg/mod/github.com/99designs/[email protected]/codegen/data.go:89 +0x4a7
github.com/99designs/gqlgen/api.Generate(0xc0001b8000, 0x0, 0x0, 0x0, 0x0, 0xc0000a2006)
/Users/foo/go/pkg/mod/github.com/99designs/[email protected]/api/generate.go:41 +0x276
github.com/99designs/gqlgen/cmd.glob..func1(0xc0001b6000)
/Users/foo/go/pkg/mod/github.com/99designs/[email protected]/cmd/gen.go:39 +0xa2
github.com/urfave/cli.HandleAction(0x1553e60, 0x1659b50, 0xc0001b6000, 0xc0001b6000, 0x0)
/Users/foo/go/pkg/mod/github.com/urfave/[email protected]/app.go:525 +0x127
github.com/urfave/cli.Command.Run(0x161d37a, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1649e4f, 0x29, 0x0, ...)
/Users/foo/go/pkg/mod/github.com/urfave/[email protected]/command.go:174 +0x521
github.com/urfave/cli.(*App).Run(0xc000102540, 0xc00000e080, 0x2, 0x2, 0x0, 0x0)
/Users/foo/go/pkg/mod/github.com/urfave/[email protected]/app.go:276 +0x729
github.com/99designs/gqlgen/cmd.Execute()
/Users/foo/go/pkg/mod/github.com/99designs/[email protected]/cmd/root.go:40 +0x224
main.main()
/Users/foo/go/pkg/mod/github.com/99designs/[email protected]/main.go:8 +0x20
md5-20ab21bc7f1ac310794f84b20e4d5371
type Subscription {
id: ID!
userID: ID!
createdAt: Int!
updatedAt: Int!
}
gqlgen version?go version?Subscription is a reserved GraphQL type, and thus, the error you're facing is likely due to the code generator failing to process the duplication. I believe an error is desired, but errors like this could stand to have a more specific message.
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.
Most helpful comment
Subscriptionis a reserved GraphQL type, and thus, the error you're facing is likely due to the code generator failing to process the duplication. I believe an error is desired, but errors like this could stand to have a more specific message.