enisdenjo / graphql-yoga-nestjs

Nest GraphQL GraphQL Yoga driver
https://the-guild.dev/graphql/yoga-server/docs/integrations/integration-with-nestjs
25 stars 11 forks source link

Federation code first example requires additional envelop plugin #80

Closed timkuilman closed 1 year ago

timkuilman commented 1 year ago

I tried running the code first federation gateway which results in the following error:

> yoga-nest-federation-gateway@0.0.1 start
> nest start

(node:97187) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
[Nest] 97187  - 02/16/2023, 12:56:24 PM     LOG [NestFactory] Starting Nest application...
[Nest] 97187  - 02/16/2023, 12:56:24 PM     LOG [InstanceLoader] AppModule dependencies initialized +17ms
[Nest] 97187  - 02/16/2023, 12:56:24 PM     LOG [InstanceLoader] GraphQLSchemaBuilderModule dependencies initialized +1ms
[Nest] 97187  - 02/16/2023, 12:56:24 PM     LOG [InstanceLoader] GraphQLModule dependencies initialized +0ms
[Nest] 97187  - 02/16/2023, 12:56:24 PM   ERROR [PackageLoader] The "@envelop/apollo-federation" package is missing. Please, make sure to install this library ($ npm install @envelop/apollo-federation) to take advantage of YogaGatewayDriver

Installing the mentioned package results in:

❯ npm install @envelop/apollo-federation
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: yoga-nest-federation-gateway@0.0.1
npm ERR! Found: @apollo/gateway@0.51.0
npm ERR! node_modules/@apollo/gateway
npm ERR!   @apollo/gateway@"0.51.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @apollo/gateway@"^0.41.0 || ^0.42.0 || ^0.43.0" from @envelop/apollo-federation@3.0.4
npm ERR! node_modules/@envelop/apollo-federation
npm ERR!   @envelop/apollo-federation@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /Users/timkuilman/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/timkuilman/.npm/_logs/2023-02-16T11_57_01_865Z-debug.log

The plugin has a peer dependency on apollo gateway that does not include version 0.51.0. The --legacy-peer-deps does indeed circumvent the issue.

Unfortunately this hack doesn't work within the repository in which I'm trying to implement federation with Yoga due to the usage of NPM workspaces.

enisdenjo commented 1 year ago

Hey there, interesting - I have no problem running the graphql-federation-code-first example.

Can you please provide a repro? Thanks!

enisdenjo commented 1 year ago

Closed in https://github.com/dotansimha/graphql-yoga/pull/2525.