wundergraph: JSON scalar types not supported
Bug description
I have an upstream graphql server that uses JSON scalar types.
When the value returned for this scalar is a JSON object, wundergraph complains with the following error:
2022-12-14T13:53:48+11:00 ERROR apihandler/apihandler.go:801 ResolveGraphQLResponse {"component": "@wundergraph/node", "reqId": "44a4ae5f-ef82-a2e9-3731-7a0284accd0b", "error": "invalid value type 'object' for path /data/bar, expecting string, got: {\"type\":\"string\"}. You can fix this by configuring this field as Int/Float Scalar"}
github.com/wundergraph/wundergraph/pkg/apihandler.(*GraphQLHandler).ServeHTTP
/home/runner/work/wundergraph/wundergraph/pkg/apihandler/apihandler.go:801
github.com/wundergraph/wundergraph/pkg/authentication.NewCSRFMw.func1.1
/home/runner/work/wundergraph/wundergraph/pkg/authentication/authentication.go:864
net/http.HandlerFunc.ServeHTTP
/opt/hostedtoolcache/go/1.18.8/x64/src/net/http/server.go:2084
github.com/wundergraph/wundergraph/pkg/authentication.NewLoadUserMw.func1.1
/home/runner/work/wundergraph/wundergraph/pkg/authentication/authentication.go:655
net/http.HandlerFunc.ServeHTTP
/opt/hostedtoolcache/go/1.18.8/x64/src/net/http/server.go:2084
github.com/rs/cors.(*Cors).Handler.func1
/home/runner/go/pkg/mod/github.com/rs/cors@v1.7.0/cors.go:219
net/http.HandlerFunc.ServeHTTP
/opt/hostedtoolcache/go/1.18.8/x64/src/net/http/server.go:2084
github.com/wundergraph/wundergraph/pkg/apihandler.(*Builder).BuildAndMountApiHandler.func4.1
/home/runner/work/wundergraph/wundergraph/pkg/apihandler/apihandler.go:233
net/http.HandlerFunc.ServeHTTP
/opt/hostedtoolcache/go/1.18.8/x64/src/net/http/server.go:2084
github.com/wundergraph/wundergraph/pkg/apihandler.logRequestMiddleware.func1.1
/home/runner/work/wundergraph/wundergraph/pkg/apihandler/apihandler.go:353
net/http.HandlerFunc.ServeHTTP
/opt/hostedtoolcache/go/1.18.8/x64/src/net/http/server.go:2084
github.com/gorilla/mux.(*Router).ServeHTTP
/home/runner/go/pkg/mod/github.com/gorilla/mux@v1.8.0/mux.go:210
net/http.serverHandler.ServeHTTP
/opt/hostedtoolcache/go/1.18.8/x64/src/net/http/server.go:2916
net/http.(*conn).serve
/opt/hostedtoolcache/go/1.18.8/x64/src/net/http/server.go:1966
How to reproduce
I have been able to create a self-contained wundergraph project to reproduce the error, using the in-built graphql server. It is attached: wgtest.zip
To reproduce:
- install dependencies with
yarn - run with
yarn start
Then visit the following URL: http://localhost:9991/operations/Hello
Expected behavior
The response from the server should be successfully returned to the caller.
For the attached project, that is:
{ "data": {"bar": {"type": "string"}} }
WunderGraph information
Included in the attached project
Environment & setup
- OS: Mint w/kernel 5.4.0-135-generic
- Go version: go version go1.13.8 linux/amd64
- Node.js version: v18.12.1
WunderCtl Version
119.1
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 24 (11 by maintainers)
@greemo
@wundergraph/sdk@0.131.0was released with this fixWe know the solution and are currently implementing it.