Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reflect: call of reflect.Value.Type on zero Value #217

Closed
microo8 opened this issue Apr 13, 2022 · 3 comments
Closed

reflect: call of reflect.Value.Type on zero Value #217

microo8 opened this issue Apr 13, 2022 · 3 comments

Comments

@microo8
Copy link

microo8 commented Apr 13, 2022

I've got this error, don't know what's going on

Using the latest gqlparser and gqlparser.

goroutine 209 [running]:
runtime/debug.Stack()
	/usr/lib/go/src/runtime/debug/stack.go:24 +0x65
runtime/debug.PrintStack()
	/usr/lib/go/src/runtime/debug/stack.go:16 +0x19
github.com/99designs/gqlgen/graphql.DefaultRecover({0xc0001226c0?, 0x0?}, {0x1052760?, 0xc00059f410?})
	/home/micro/.go/pkg/mod/github.com/99designs/gqlgen@v0.17.3-0.20220411111311-9f5fad13fa62/graphql/recovery.go:17 +0x71
github.com/99designs/gqlgen/graphql/executor.(*Executor).PresentRecoveredError(0xc000119a40, {0x1359630, 0xc000542930}, {0x1052760?, 0xc00059f410?})
	/home/micro/.go/pkg/mod/github.com/99designs/gqlgen@v0.17.3-0.20220411111311-9f5fad13fa62/graphql/executor/executor.go:143 +0x46
github.com/99designs/gqlgen/graphql/handler.(*Server).ServeHTTP.func1()
	/home/micro/.go/pkg/mod/github.com/99designs/gqlgen@v0.17.3-0.20220411111311-9f5fad13fa62/graphql/handler/server.go:104 +0x99
panic({0x1052760, 0xc00059f410})
	/usr/lib/go/src/runtime/panic.go:838 +0x207
reflect.Value.Type({0x0?, 0x0?, 0x122a902?})
	/usr/lib/go/src/reflect/value.go:2451 +0x12e
github.com/vektah/gqlparser/v2/validator.(*varValidator).validateVarType(0xc0000ee800, 0xc00048ff50, {0x0?, 0x0?, 0x100f340?})
	/home/micro/.go/pkg/mod/github.com/vektah/gqlparser/v2@v2.4.2-0.20220410185821-5bb131d67faa/validator/vars.go:105 +0xc96
github.com/vektah/gqlparser/v2/validator.(*varValidator).validateVarType(0xc0000ee800, 0xc00048ff20, {0xffd760?, 0xc00059f3e0?, 0xc00006dc50?})
	/home/micro/.go/pkg/mod/github.com/vektah/gqlparser/v2@v2.4.2-0.20220410185821-5bb131d67faa/validator/vars.go:119 +0xf7c
github.com/vektah/gqlparser/v2/validator.(*varValidator).validateVarType(0xc0000ee800, 0xc000588d50, {0x1062400?, 0xc00025be90?, 0xbc373d?})
	/home/micro/.go/pkg/mod/github.com/vektah/gqlparser/v2@v2.4.2-0.20220410185821-5bb131d67faa/validator/vars.go:231 +0x15c5
github.com/vektah/gqlparser/v2/validator.VariableValues(0xc0001780a0, 0xc0005298f0, 0xc0000c8090?)
	/home/micro/.go/pkg/mod/github.com/vektah/gqlparser/v2@v2.4.2-0.20220410185821-5bb131d67faa/validator/vars.go:77 +0x5ce
github.com/99designs/gqlgen/graphql/executor.(*Executor).CreateOperationContext(0xc000119a40, {0x1359630, 0xc00025bdd0}, 0xc00011dc20)
	/home/micro/.go/pkg/mod/github.com/99designs/gqlgen@v0.17.3-0.20220411111311-9f5fad13fa62/graphql/executor/executor.go:74 +0x48c
github.com/99designs/gqlgen/graphql/handler/transport.(*wsConnection).subscribe(0xc0002a60f0, {0xc000542930?, 0xc000171040?, 0x1a93380?}, 0xc0005435c0)
	/home/micro/.go/pkg/mod/github.com/99designs/gqlgen@v0.17.3-0.20220411111311-9f5fad13fa62/graphql/handler/transport/websocket.go:307 +0x22d
github.com/99designs/gqlgen/graphql/handler/transport.(*wsConnection).run(0xc0002a60f0)
	/home/micro/.go/pkg/mod/github.com/99designs/gqlgen@v0.17.3-0.20220411111311-9f5fad13fa62/graphql/handler/transport/websocket.go:237 +0x629
github.com/99designs/gqlgen/graphql/handler/transport.Websocket.Do({{0x0, 0x0, 0x0, {0x0, 0x0}, {0xc000044120, 0x2, 0x2}, 0x0, 0x0, ...}, ...}, ...)
	/home/micro/.go/pkg/mod/github.com/99designs/gqlgen@v0.17.3-0.20220411111311-9f5fad13fa62/graphql/handler/transport/websocket.go:94 +0x311
github.com/99designs/gqlgen/graphql/handler.(*Server).ServeHTTP(0xc00054c480, {0x1358ef0, 0xc00021a380}, 0xc00009a600)
	/home/micro/.go/pkg/mod/github.com/99designs/gqlgen@v0.17.3-0.20220411111311-9f5fad13fa62/graphql/handler/server.go:120 +0x33d
@microo8
Copy link
Author

microo8 commented Apr 13, 2022

I was sending invalid json value [null] for a field with [][]string type

@microo8 microo8 closed this as completed Apr 13, 2022
@StevenACoffman
Copy link
Collaborator

Glad you figured it out, but I'm sorry we didn't do more to make that easier. @microo8 I would love a PR that gives a better error message in that situation.

@microo8
Copy link
Author

microo8 commented Apr 13, 2022

The correct way would be, that it doesn't crash, but just responds to the client that the request isn't valid.
I would love to work on it, but have no time spare for it :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants