You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I set the context in the Apollo Server Plugin, it doesn't get the request object. I believe this is because of the way Apollo Server 4 changed their context object.
My code:
// Apollo Server Plugin for Elysiaapp.use(apollo({path: '/graphql',enablePlayground: true,// Default is disabled in production
typeDefs,// Import schema from .graphql file
resolvers,// Import resolvers from resolvers.js,context: async(foo)=>{console.log('foo',foo);// {}return{dataSources: {}}}}),);
In this case, any request I make the foo object is empty {} with no request information.
Because Elysia is based on Web Standard Request and Response which is different from Node's HttpRequest and HttpResponse that Express use, result in req, and res being undefined in context.
However, we can add a web standard's Request instead to make a suitable equivalent.
When I set the
context
in the Apollo Server Plugin, it doesn't get therequest
object. I believe this is because of the way Apollo Server 4 changed their context object.My code:
In this case, any request I make the
foo
object is empty{}
with no request information.https://www.apollographql.com/docs/apollo-server/migration/#context-initialization-function
Could this be done in a similar way to how the express middleware for Apollo Server 4 handles the change?
Or maybe I'm missing something obvious to capture the request object in my context, if so, sorry!
The text was updated successfully, but these errors were encountered: