-
Notifications
You must be signed in to change notification settings - Fork 2k
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
apollo-server-fastify's context function now receives reply object. #3895
Conversation
@HW13: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/ |
Here's a quick test to confirm the existence of this bug -> https://github.com/autotelic/apollo-fastify-bug-test. Cheers. |
@HW13 it looks like this will also fix an issue where Apollo is stripping Fastify request decorators. Is that true? |
I was able to access request decorators in my tests, but I don't think these changes had an affect on that. This PR just adds a function that nests the request and reply in an object before passing it to |
Thanks. |
The GraphQL throttler works well for Express but it does have problems when it comes to fastify due to [this pull request](apollographql/apollo-server#3895). Once this is merged in we can start looking at supporting Fastify as well for GraphQL.
The GraphQL throttler works well for Express but it does have problems when it comes to fastify due to [this pull request](apollographql/apollo-server#3895). Once this is merged in we can start looking at supporting Fastify as well for GraphQL.
The GraphQL throttler works well for Express but it does have problems when it comes to fastify due to [this pull request](apollographql/apollo-server#3895). Once this is merged in we can start looking at supporting Fastify as well for GraphQL.
Has this been closed because the issue has been addressed? |
Unintentional closing! Please stand-by: #4304 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think my only request here is that we align with the patterns in the rest of the repository (on other integrations) as much as possible. I've replied within below about that.
Otherwise, this PR should also update this API documentation.
Hey @abernix, thanks for the review! The changes you've requested have been implemented. When you have a chance, could you give this another look? Cheers. |
1bbeb2d
to
d946d1e
Compare
Quick update -> I needed to make some minor tweaks ( |
- Add createGraphQLServerOptions method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I'll add a CHANGELOG.md
and get this merged momentarily. (Likely released later today.)
📣 Published in |
@HW13 @abernix This is a breaking change and should have been a major bump. Previously we have the |
It appears the branch that introduced this documentation was forked from prior to that change and that this particular changedidn't get pulled back in during conflict resolution. Original: 090586c#diff-c7c64f07d21dfa37133d976476500b03R65
* Content-complete on ApolloServer constructor and EngineReportingOptions updates * Fix some broken links * Fix some broken headers * Incorporate #4426 change and merge segmented tables * Use HTML-md-hybrid table to enable custom styles * Use new API reference front matter and update some headers * Use two-column field table layout * Intentionally leave old EngineReportingOptions format, for more optimal formatting, since it's going away soon anyway. * Put experimental AS constructor option in its own table * Re-apply lost Fastify context signature changes (from #3895) * Re-apply lost spelling correction (from #4473) Co-authored-by: Stephen Barlow <[email protected]> Co-authored-by: Jesse Rosenberger <[email protected]>
Problem
The context function in
apollo-server-fastify
is not receiving thereply
object. This is due to therequest
andreply
being spread intographqlServerOptions
(in resolveGraphqlOptions via runHttpQuery) - butgraphqlServerOptions
is expecting an object (here).Related Issues
Solution
Add
applyContextArgs
function which receives thereply
andrequest
being spread in, and places them into an object which is then passed intographqlServerOptions
.Test plan
Confirm unit tests pass:
Closes #3156