panic and internal system error - with query variable containing malformed JSON input
- Lenguaje dominante
- Go
- Estrellas
- 10.8k
- Forks
- 1.3k
- Merge medio
- 2 d 36 min
- PR fusionados (30 d)
- 26
Descripción
### What happened?
{"errors":[{"message":"internal system error"}],"data":null}
StackTrace:
missing operation context
goroutine 11983 [running]:
runtime/debug.Stack()
/opt/homebrew/opt/go/libexec/src/runtime/debug/stack.go:24 +0x6c
runtime/debug.PrintStack()
/opt/homebrew/opt/go/libexec/src/runtime/debug/stack.go:16 +0x24
github.com/99designs/gqlgen/graphql.DefaultRecover({0xc001286590?, 0xc001286597?}, {0x107fd8980, 0x108321d10})
/Users/dwartell/golang/pkg/mod/github.com/99designs/gqlgen@v0.17.35/graphql/recovery.go:17 +0xa4
github.com/99designs/gqlgen/graphql/executor.(*Executor).PresentRecoveredError(0xc000ba60a0, {0x108338d00, 0xc000fce120}, {0x107fd8980, 0x108321d10})
/Users/dwartell/golang/pkg/mod/github.com/99designs/gqlgen@v0.17.35/graphql/executor/executor.go:156 +0x68
github.com/99designs/gqlgen/graphql/handler.(*Server).ServeHTTP.func1()
/Users/dwartell/golang/pkg/mod/github.com/99designs/gqlgen@v0.17.35/graphql/handler/server.go:104 +0xfc
panic({0x107fd8980, 0x108321d10})
/opt/homebrew/opt/go/libexec/src/runtime/panic.go:890 +0x258
github.com/99designs/gqlgen/graphql.GetOperationContext({0x108338d00, 0xc000fce180})
/Users/dwartell/golang/pkg/mod/github.com/99designs/gqlgen@v0.17.35/graphql/context_operation.go:65 +0x94
github.com/stealthmodesoft/rwsecure/server/internal/graphserver/gqlprometheus.Tracer.InterceptResponse({}, {0x108338d00, 0xc000fce180}, 0xc002b7e2e8)
/Users/dwartell/freebird/rwsecure/server/internal/graphserver/gqlprometheus/prometheus.go:129 +0x3c
github.com/99designs/gqlgen/graphql/executor.processExtensions.func6({0x108338d00, 0xc000fce180}, 0x10831ad20)
/Users/dwartell/golang/pkg/mod/github.com/99designs/gqlgen@v0.17.35/graphql/executor/extensions.go:91 +0xf8
github.com/99designs/gqlgen/graphql/executor.(*Executor).DispatchError(0xc000ba60a0, {0x108338d00, 0xc000fce120}, {0xc001286580, 0x1, 0x104b95750?})
/Users/dwartell/golang/pkg/mod/github.com/99designs/gqlgen@v0.17.35/graphql/executor/executor.go:144 +0x1d8
github.com/99designs/gqlgen/graphql/handler/transport.POST.Do({0x1092b6140?}, {0x11339d680?, 0xc000928b00}, 0xc000928d00, {0x108336f60, 0xc000ba60a0})
/Users/dwartell/golang/pkg/mod/github.com/99designs/gqlgen@v0.17.35/graphql/handler/transport/http_post.go:76 +0x7b8
github.com/99designs/gqlgen/graphql/handler.(*Server).ServeHTTP(0xc00090b680, {0x11339d680, 0xc000928b00}, 0xc000928d00)
/Users/dwartell/golang/pkg/mod/github.com/99designs/gqlgen@v0.17.35/graphql/handler/server.go:121 +0x2dc
### What did you expect?
Intelligent error message informing client that input JSON is malformed. The context of syntax and error would be nice too, should be available from JSON parser.
### Minimal graphql.schema and models to reproduce
```
type Query {
searchAutocomplete(
filter: SearchAutocompleteFilter
limit: Int
): SearchAutocompletePayload!
}
type SearchAutocompletePayload {
matches: [String!]
}
input SearchAutocompleteFilter {
key: String
prefix: String
}
### Query Request Body
query: "query($filter: SearchAutocompleteFilter, $limit: Int) {
searchAutocomplete(filter: $filter, limit: $limit) {
matches
}
}"
variables: "{
"filter": {
"key": "foo"
"prefix": "bar"
},
"limit": 1000
}"
```
**Notice missing comma after: "key": "foo"**
### versions
- `go run github.com/99designs/gqlgen version`? v0.17.35
- `go version`? go version go1.20.5 darwin/arm64
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.