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 |
abernix
left a comment
There was a problem hiding this comment.
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.
abernix
left a comment
There was a problem hiding this comment.
LGTM! I'll add a CHANGELOG.md and get this merged momentarily. (Likely released later today.)
|
Awesome, thanks @abernix! 😎 👍 |
|
📣 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 <StephenBarlow@users.noreply.github.com> Co-authored-by: Jesse Rosenberger <git@jro.cc>
Problem
The context function in
apollo-server-fastifyis not receiving thereplyobject. This is due to therequestandreplybeing spread intographqlServerOptions(in resolveGraphqlOptions via runHttpQuery) - butgraphqlServerOptionsis expecting an object (here).Related Issues
Solution
Add
applyContextArgsfunction which receives thereplyandrequestbeing spread in, and places them into an object which is then passed intographqlServerOptions.Test plan
Confirm unit tests pass:
Closes #3156