request
on YogaInitialContext
is conflicting with the request
on the Koa server context
#3145
Labels
kind/docs
Improvements or additions to documentation
Describe the bug
We integrated GraphQL Yoga with the Koa server as documented here https://the-guild.dev/graphql/yoga-server/docs/integrations/integration-with-koa
and pass the Koa context like this
The Koa context contains the Koa request as a
request
property on the context. However the Yoga server assumes that therequest
property on the context it is actually the internal platform-independent Fetch Request.This causes problems e.g. in the use-schema plugin (https://github.com/dotansimha/graphql-yoga/blob/main/packages/graphql-yoga/src/plugins/use-schema.ts)
During
onRequestParseDone
the schema is placed in the WeekMap based on the Yoga request, however withinonEnveloped
the WeakMap is accessed based on the Koa request from the Context. Since this is different the schema cannot be found and the plugin fails.A potential workaround of removing
request
from the Koa context before passing it to Yoga doesn't work, because the request is internally referenced from the context and it becomes dysfunctional.BTW the same issue exists within the
useDisableIntrospection
plugin.Your Example Website or App
sorry no example, but the problem should be clear from the description
Steps to Reproduce the Bug or Issue
I hope the above description is enough to understand the issue
Expected behavior
request
property on the context is the Yogarequest
Screenshots or Videos
No response
Platform
@graphql-yoga/*
version): 5.0.2Additional context
No response
The text was updated successfully, but these errors were encountered: