apollo-server: [apollo-server-fastify] playground not working
I followed the instructions at https://www.npmjs.com/package/apollo-server-fastify and the /graphql
endpoint works but it doesn’t run the playground even with playground: true, introspection: true
in the settings.
Versions
"dependencies": {
"fastify": "3.2.0",
"apollo-server-fastify": "2.16.1"
},
Expected behavior:
Going to /graphql
with a browser should run the playground
Actual behavior:
It shows: GET query missing.
How to reproduce it:
You can run the example in a CodeSandbox:
https://codesandbox.io/s/wispy-dream-66j5g?file=/package.json:197-281
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 36
- Comments: 21 (4 by maintainers)
+1
To fix this issue, I simply upgrade the
apollo-server-fastify
to “apollo-server-fastify”: “^3.0.0-alpha.3” .The alpha version seems not safe, But I didn’t see any errors so far
Thanks @abernix for the update. We are working with a client to deploy a graphql gateway/orchestrator solution. We have an sla for high throughput, which is why I’m recommending Fastify as the underlying web framework. Apollo server needs to side with performance because it often ends up in the forefront ingesting all traffic in transitional architectures, and therefore Fastify (the performance web framework) is equally important to prioritize. I am excited to get graphql and Apollo into production in the near future and thanks for the great work.
Same here, when using it with nestJs. Got the same result of
GET query missing
.Although this issue may be fixed, I’m unable to test it with
3.0.0-alpha.4
due to startup error:TypeError: this.ensureStarting is not a function at ApolloServer.createHandler (/node_modules/apollo-server-fastify/dist/ApolloServer.js:22:14)
This is fixed on the release-3.0 branch, which supports Fastify v3 (only). Apollo Server 3.0 is now under active development; I hope to get some alphas out within a week.
+1
Faced the same issue. Seems like its because this package doesnt support fastify v3. Downgrading to fastify 2 makes it work.
I guess we can either wait for https://github.com/apollographql/apollo-server/pull/4356 to land or downgrade to fastify v2 for the time being.
For those attempting to use Apollo Server 3.x for its newer Fastify version, please see https://github.com/apollographql/apollo-server/pull/4356#issuecomment-677515901, which is a comment I wrote for a similar audience on another PR which introduced the functionality. In particular, pay attention to my suggestion in that comment about reading the v3
CHANGELOG.md
for details on howinstallSubscriptionsHandlers
is affected (Subscriptions has been de-coupled from the core of the project, but is still installable separately).Weird. I have the same versions for everything but
graphql-tools
, for which I have^6.2.5
. I decided to change back to express for now until apollo-server-fastify 3 leaves alpha. Thanks @Duduzera1997!@phattranky @Duduzera1997 I upgraded to the alpha version but get this error. What version of the
graphql
and@nestjs/graphql
packages are you using?Would love an update for Fastify v3!