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
This worked in apollo server 3.x and I think it should still work in apollo server 4.x.
The context was mutable between the resolvers and data sources. And, if the same object is passed to Apollo Server and the Data Sources, then I would expect the reference to be the same for that request.
That is a good point. We could consider just doing the clone in the http batching codepath rather than always. This might qualify as a backwards-incompatible change, though.
Issue Description
This worked in apollo server 3.x and I think it should still work in apollo server 4.x.
The context was mutable between the resolvers and data sources. And, if the same object is passed to Apollo Server and the Data Sources, then I would expect the reference to be the same for that request.
Link to Reproduction
https://codesandbox.io/p/devbox/green-dew-s6pz7j?file=%2Fsrc%2Findex.ts%3A31%2C6&workspaceId=9fba286e-b0a2-40d4-9a10-3ed17d6fc084
Reproduction Steps
EXPECT:
console.log("context in api", this.context)
to log a context with the user property filled.ACTUAL:
console.log("context in api", this.context)
's user property is null.It should get populated from the authenticate directive. You can see that the resolver has it (which makes sense since we literally pass it though).
This worked in apollo server 3.x. And I don't see why it shouldn't work in apollo server 4.x.
The text was updated successfully, but these errors were encountered: