Open dourkk opened 4 days ago
Hello! Ideally someone would build a Nest.js optimized server adaptor for Grafserv, like these: https://github.com/graphile/crystal/tree/main/grafast/grafserv/src/servers
But given you had it working in V4 it's likely you can hack something together using the node adaptor; see
https://postgraphile.org/postgraphile/next/usage-library
and
https://grafast.org/grafserv/servers/node
But rather than doing serv.addTo(server)
you can use serv
's handlers directly:
serv.graphqlHandler
,serv.graphiqlHandler
,Doing so will mean that certain plugin middlewares won't be called, so be aware of that. If you want to submit a Nest.js adaptor I'd be happy to pair program with you for a couple of hours to help develop it if you want; the session would be public and recorded to help future adaptors be written.
If you're going alone or taking the hack approach, use TypeScript to guide you and/or read the source starting here: https://github.com/graphile/crystal/blob/ae2bf43f4b3ccc0c545f52addbdd4e4e1db40206/grafast/grafserv/src/servers/node/index.ts#L295
Thanks for the answer @benjie 🙏
For context we wanted to do the migration, because we were getting this error recently in our logs
Error: Cannot use GraphQLSchema "{ __validationErrors: [], description: undefined, extensions: {}, ast │
│ │
│ Ensure that there is only one instance of "graphql" in the node_modules │
│ directory. If different versions of "graphql" are the dependencies of other │
│ relied on modules, use "resolutions" to ensure only one version is installed. │
│ │
│ https://yarnpkg.com/en/docs/selective-version-resolutions │
│ │
│ Duplicate "graphql" modules cannot be used at the same time since different │
│ versions may have different capabilities and behavior. The data from one │
│ version used in the function from another could produce confusing and │
│ spurious results. │
│ at instanceOf (/usr/src/app/node_modules/postgraphile/node_modules/graphql/jsutils/instanceOf.js:3 │
│ at isSchema (/usr/src/app/node_modules/postgraphile/node_modules/graphql/type/schema.js:42:34) │
│ at assertSchema (/usr/src/app/node_modules/postgraphile/node_modules/graphql/type/schema.js:46:8) │
│ at validateSchema (/usr/src/app/node_modules/postgraphile/node_modules/graphql/type/validate.js:42 │
│ at assertValidSchema (/usr/src/app/node_modules/postgraphile/node_modules/graphql/type/validate.js │
│ at Object.validate (/usr/src/app/node_modules/postgraphile/node_modules/graphql/validation/validat │
│ at parseQuery (/usr/src/app/node_modules/postgraphile/build/postgraphile/http/createPostGraphileHt │
│ at /usr/src/app/node_modules/postgraphile/build/postgraphile/http/createPostGraphileHttpRequestHan │
│ at Array.map (<anonymous>) │
│ at graphqlRouteHandler (/usr/src/app/node_modules/postgraphile/build/postgraphile/http/createPostG │
│ Stream canceled read tcp some_ip:60935->some_ip:443: use of closed network connection for │
We tried to resolve the graphql dependency to 15.9.0, but still getting the same issue 🥲
"resolutions": {
"graphql": "15.9.0"
}
Try also adding an explicit dependency on graphql@15.x, and consider downgrading msw so it uses graphql@15.x too.
Summary
Hi, we are using Nestjs, and we would like to migrate from v4 to v5, but we were not able to find info about
postgraphileMiddleware.graphqlRouteHandler
is it still supported or what is the new way to achieve the following?Additional context
Here are our
postgraphile.middleware.ts
configHere is our
postgraphile.controller.ts
controller