graphql icon indicating copy to clipboard operation
graphql copied to clipboard

@nestjs/platform-fastify: fastify version mismatch Apollo v3 requirements

Open karolh95 opened this issue 2 years ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current behavior

Application throws FastifyError: fastify-plugin: fastify-accepts - expected '3.x' fastify version, '4.2.1' is installed

Minimum reproduction code

https://github.com/karolh95/nestjs-fastify

Steps to reproduce

  1. run yarn install
  2. run yarn start:dev

Expected behavior

Application should start without throwing any exceptions

Package

  • [ ] I don't know. Or some 3rd-party package
  • [ ] @nestjs/common
  • [ ] @nestjs/core
  • [ ] @nestjs/microservices
  • [ ] @nestjs/platform-express
  • [X] @nestjs/platform-fastify
  • [ ] @nestjs/platform-socket.io
  • [ ] @nestjs/platform-ws
  • [ ] @nestjs/testing
  • [ ] @nestjs/websockets
  • [ ] Other (see below)

Other package

No response

NestJS version

9.0.1

Packages versions

[System Information] OS Version : Linux 5.4 NodeJS Version : v14.18.1 YARN Version : 1.22.17

[Nest CLI] Nest CLI Version : 9.0.0

[Nest Platform Information] platform-express version : 9.0.4 platform-fastify version : 9.0.4 schematics version : 9.0.1 graphql version : 10.0.18 testing version : 9.0.4 apollo version : 10.0.17 common version : 9.0.4 core version : 9.0.4 cli version : 9.0.0

Node.js version

14.18.1

In which operating systems have you tested?

  • [ ] macOS
  • [ ] Windows
  • [X] Linux

Other

NestJS docs:

@nestjs/graphql@>=9 and @nestjs/apollo^10 packages are compatible with Apollo v3

Apollo docs:

Apollo Server 3 supports Fastify v3.

nestjs/[email protected] dependency:

   "@fastify/cors" "8.0.0"
    "@fastify/formbody" "7.0.1"
    "@fastify/middie" "8.0.0"
    fastify "4.2.1"
    light-my-request "5.1.0"
    path-to-regexp "3.2.0"
    tslib "2.4.0"

@fastify/cors and @fastify/formbody supports Fastify versions 3.x

karolh95 avatar Jul 18 '22 09:07 karolh95

https://github.com/apollographql/apollo-server/issues/6576

Fastify v4 cannot be used with apollo-server-fastify v3. If you're using Fastify + NestJS + Apollo, I'd suggest not upgrading to v9 just yet

kamilmysliwiec avatar Jul 20 '22 08:07 kamilmysliwiec

https://github.com/nestjs/graphql/pull/2636#issuecomment-1429493262

kamilmysliwiec avatar Mar 06 '23 07:03 kamilmysliwiec