diff --git a/graphql/context.go b/graphql/context.go index 85e63495527..62950924b8d 100644 --- a/graphql/context.go +++ b/graphql/context.go @@ -240,5 +240,10 @@ func WithInitPayload(ctx context.Context, payload InitPayload) context.Context { // GetInitPayload gets the payload from context. func GetInitPayload(ctx context.Context) InitPayload { - return ctx.Value(initpayload).(InitPayload) + payload, ok := ctx.Value(initpayload).(InitPayload) + if !ok { + return nil + } + + return payload }