mercurius-js / mercurius

Implement GraphQL servers and gateways with Fastify
https://mercurius.dev/
MIT License
2.33k stars 234 forks source link

GraphiQL issues in newest release #1046

Closed EDjur closed 8 months ago

EDjur commented 9 months ago

Hi! 👋

There seems to have been some change in how the GraphiQL endpoint is mapped in the new release.

I register one of my Mercurius instances on Fastify like this:

server.register(
  async (serverInstance) => {
    await serverInstance.register(mercurius, {
      schema,
      resolvers,
      loaders,
      graphiql: true,
      path: "",
      context,
    });
  },
  { prefix: "/graphql" }
);

Now, if I go to myApp/graphql/graphiql, all POST requests try to access /graphql/graphql.

{
  "message": "Route POST:/graphql/graphql not found",
  "error": "Not Found",
  "statusCode": 404
}

This didn't use to happen in previous versions.

Thanks!

mcollina commented 9 months ago

If you can send a PR it would be amazing, otherwise it might take a few days to fix.

nandorodrigu3s commented 8 months ago

hi there, guys. @mcollina I'm facing this situation too so I decided to create the PR.

here is the link https://github.com/mercurius-js/mercurius/pull/1052