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

Error when using gqlapollotracing with subscriptions #10

Open
Daavidaviid opened this issue Feb 6, 2019 · 2 comments
Open

Error when using gqlapollotracing with subscriptions #10

Daavidaviid opened this issue Feb 6, 2019 · 2 comments

Comments

@Daavidaviid
Copy link

Hi,

I've been using gqlapollotracing but lately when I started playing with subscriptions I realized the subscriptions only work when I don't use tracing, otherwise I get this error when I subscribe to a subscription and a value is sent through the chan:

interface conversion: interface {} is nil, not *gqlapollotracing.tracingData

goroutine 28 [running]:
runtime/debug.Stack(0x1, 0x0, 0x0)
        /usr/local/go/src/runtime/debug/stack.go:24 +0xa7
runtime/debug.PrintStack()
        /usr/local/go/src/runtime/debug/stack.go:16 +0x22
github.com/99designs/gqlgen/graphql.DefaultRecover(0x193f9a0, 0xc00042dcc0, 0x1783500, 0xc000b320f0, 0x203000, 0x203000)
        /Users/Username/golang/src/github.com/99designs/gqlgen/graphql/recovery.go:16 +0xa7
github.com/99designs/gqlgen/handler.(*wsConnection).subscribe.func1.1(0xc0000b70e0, 0x193f9a0, 0xc00042dcc0, 0xc000b1e2d0, 0xc00042d800)
        /Users/Username/golang/src/github.com/99designs/gqlgen/handler/websocket.go:223 +0x73
panic(0x1783500, 0xc000b320f0)
        /usr/local/go/src/runtime/panic.go:513 +0x1b9
github.com/99designs/gqlgen-contrib/gqlapollotracing.getTracingData(0x193fa60, 0xc000ad9ec0, 0xc000086800)
        /Users/Username/golang/src/github.com/99designs/gqlgen-contrib/gqlapollotracing/tracer.go:25 +0x88
github.com/99designs/gqlgen-contrib/gqlapollotracing.(*tracerImpl).StartFieldExecution(0x1f023d0, 0x193fa60, 0xc000ad9ec0, 0xc0000dcb80, 0x0, 0x0, 0x0, 0x0, 0x0)
        /Users/Username/golang/src/github.com/99designs/gqlgen-contrib/gqlapollotracing/tracer.go:67 +0x58
MY_APP/graphql/gql.(*executionContext)._Message_content(0xc000b60970, 0x193fa60, 0xc000ad9ec0, 0xc0000dcb80, 0x0, 0x0, 0x0, 0xc0000dcc80, 0x0, 0x0)
        /Users/Username/workspace/MY_APP_MONOREPO/golang/src/MY_APP/graphql/gql/generated_gen.go:6471 +0xde
MY_APP/graphql/gql.(*executionContext)._Message(0xc000b60970, 0x193fa60, 0xc000ad9ec0, 0xc0000fd040, 0x2, 0x2, 0xc0000dcc80, 0x1, 0xc000b32090)
        /Users/Username/workspace/MY_APP_MONOREPO/golang/src/MY_APP/graphql/gql/generated_gen.go:6380 +0x826
MY_APP/graphql/gql.(*executionContext)._Subscription_messageAdded.func1.1(0xc000b60970, 0x193fa60, 0xc000ad9ec0, 0xc0000dcb00, 0xc0000fd040, 0x2, 0x2, 0xc0000dcc80, 0x17d7c20, 0xc000067c01)
        /Users/Username/workspace/MY_APP_MONOREPO/golang/src/MY_APP/graphql/gql/generated_gen.go:11204 +0x74
MY_APP/graphql/gql.(*executionContext)._Subscription_messageAdded.func1(0xc00003ec30, 0x205cd80)
        /Users/Username/workspace/MY_APP_MONOREPO/golang/src/MY_APP/graphql/gql/generated_gen.go:11205 +0x17a
MY_APP/graphql/gql.(*executableSchema).Subscription.func1.1(0x193f9a0, 0xc00042dcc0, 0xc00042dcc0, 0x193f9a0, 0xc00042dcc0)
        /Users/Username/workspace/MY_APP_MONOREPO/golang/src/MY_APP/graphql/gql/generated_gen.go:2973 +0x47
github.com/99designs/gqlgen/handler.Tracer.func1.1(0x193f9a0, 0xc00042dcc0, 0xc0000fd0c0, 0xc0000fd0e0, 0x0, 0xc000b5e000)
        /Users/Username/golang/src/github.com/99designs/gqlgen/handler/graphql.go:168 +0x78
github.com/99designs/gqlgen/handler.RequestMiddleware.func1.1.1(0x193f9a0, 0xc00042dcc0, 0xc00000e168, 0x18, 0x18)
        /Users/Username/golang/src/github.com/99designs/gqlgen/handler/graphql.go:145 +0x42
github.com/99designs/gqlgen-contrib/gqlapollotracing.RequestMiddleware.func1(0x193f9a0, 0xc00042dcc0, 0xc0000fd0e0, 0x100e158,0x20, 0x17bd340)
        /Users/Username/golang/src/github.com/99designs/gqlgen-contrib/gqlapollotracing/middleware.go:11 +0x3e
github.com/99designs/gqlgen/handler.RequestMiddleware.func1.1(0x193f9a0, 0xc00042dcc0, 0xc0000fd0c0, 0xc000ad9e30, 0xc000b606b0, 0x1)
        /Users/Username/golang/src/github.com/99designs/gqlgen/handler/graphql.go:144 +0x8f
MY_APP/graphql/gql.(*executableSchema).Subscription.func1(0xc00047c000)
        /Users/Username/workspace/MY_APP_MONOREPO/golang/src/MY_APP/graphql/gql/generated_gen.go:2971 +0xb5
github.com/99designs/gqlgen/handler.(*wsConnection).subscribe.func1(0xc0000b70e0, 0x193f9a0, 0xc00042dcc0, 0xc000b1e2d0, 0xc00042d800, 0xc0000de2a0, 0xc000b60960)
        /Users/Username/golang/src/github.com/99designs/gqlgen/handler/websocket.go:228 +0xba
created by github.com/99designs/gqlgen/handler.(*wsConnection).subscribe
        /Users/Username/golang/src/github.com/99designs/gqlgen/handler/websocket.go:220 +0x52c

Here's where I use tracing :

gqlHandler := handler.GraphQL(
		// ...
		handler.RequestMiddleware(gqlapollotracing.RequestMiddleware()),
		handler.Tracer(gqlapollotracing.NewTracer()),
		// ...
	)

So for the moment I'm just gonna stop using it. I'll try digging into it If I have time.

Thanks for your work.

@qJkee
Copy link

qJkee commented Jun 30, 2019

same here

@leebenson
Copy link

Similar error with gqlopencensus:

// ...
handler.Tracer(gql.NewMultiTracer(gqlopencensus.New(), gqllogger.New()))
// ...

Dump:

interface conversion: interface {} is nil, not time.Time

goroutine 28 [running]:
runtime/debug.Stack(0x1, 0x0, 0x0)
	/usr/local/Cellar/go/1.13/libexec/src/runtime/debug/stack.go:24 +0x9d
runtime/debug.PrintStack()
	/usr/local/Cellar/go/1.13/libexec/src/runtime/debug/stack.go:16 +0x22
github.com/99designs/gqlgen/graphql.DefaultRecover(0x21ea260, 0xc0004ba880, 0x1dd9760, 0xc0005ac510, 0x203000, 0x203000)
	/Users/leebenson/dev/omitted/vendor/github.com/99designs/gqlgen/graphql/recovery.go:16 +0xa7
github.com/99designs/gqlgen/handler.(*wsConnection).subscribe.func1.1(0xc00010a420, 0x21ea260, 0xc0004ba880, 0xc0005300c0, 0xc0004ba640)
	/Users/leebenson/dev/omitted/vendor/github.com/99designs/gqlgen/handler/websocket.go:258 +0x73
panic(0x1dd9760, 0xc0005ac510)
	/usr/local/Cellar/go/1.13/libexec/src/runtime/panic.go:679 +0x1b2
github.com/omitted/pkg/gqllogger.tracerImpl.EndOperationExecution(0x0, 0x21ea320, 0xc0005ac4e0)
	/Users/leebenson/dev/omitted/pkg/gqllogger/tracer.go:126 +0x3c9
github.com/omitted/pkg/gql.multitracerImpl.EndOperationExecution(0xc0004546a0, 0x2, 0x2, 0x21ea320, 0xc0005ac4e0)
	/Users/leebenson/dev/omitted/pkg/gql/multitracer.go:88 +0x6e
github.com/99designs/gqlgen/handler.Tracer.func1.1(0x21ea320, 0xc0005ac4e0, 0xc00059afa0, 0x1e95ca0, 0xc0005ac450, 0xc0004ba880)
	/Users/leebenson/dev/omitted/vendor/github.com/99designs/gqlgen/handler/graphql.go:202 +0xbe
github.com/omitted/pkg/gql.(*executableSchema).Subscription.func1(0xc0001c0a00)
	/Users/leebenson/dev/omitted/pkg/gql/exec.go:6519 +0xb5
github.com/99designs/gqlgen/handler.(*wsConnection).subscribe.func1(0xc00010a420, 0x21ea260, 0xc0004ba880, 0xc0005300c0, 0xc0004ba640, 0xc000375ce0, 0xc00046b1f0)
	/Users/leebenson/dev/omitted/vendor/github.com/99designs/gqlgen/handler/websocket.go:263 +0xed
created by github.com/99designs/gqlgen/handler.(*wsConnection).subscribe
	/Users/leebenson/dev/omitted/vendor/github.com/99designs/gqlgen/handler/websocket.go:255 +0x680

facebook-github-bot pushed a commit to magma/magma that referenced this issue Feb 6, 2020
Summary: Tracer crashes when called from subscriptions (see: 99designs/gqlgen-contrib#10).

Reviewed By: idoshveki

Differential Revision: D19742172

fbshipit-source-id: 3038c3187d693c93b71cba6cb63d07b595f4c5f6
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

3 participants