Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fastify version conflict #9957

Closed
3 of 15 tasks
mdalaminbey opened this issue Jul 19, 2022 · 8 comments
Closed
3 of 15 tasks

Fastify version conflict #9957

mdalaminbey opened this issue Jul 19, 2022 · 8 comments
Labels
needs triage This issue has not been looked into

Comments

@mdalaminbey
Copy link

mdalaminbey commented Jul 19, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

FastifyError: fastify-plugin: fastify-accepts - expected '3.x' fastify version, '4.2.1' is installed at Object.checkVersion (D:\doatkolom\fix-npm\node_modules\fastify\lib\pluginUtils.js:118:11) at Object.registerPlugin (D:\doatkolom\fix-npm\node_modules\fastify\lib\pluginUtils.js:133:16) at Boot.override (D:\doatkolom\fix-npm\node_modules\fastify\lib\pluginOverride.js:28:57) at Plugin.exec (D:\doatkolom\fix-npm\node_modules\avvio\plugin.js:79:33) at Boot.loadPlugin (D:\doatkolom\fix-npm\node_modules\avvio\plugin.js:272:10) at processTicksAndRejections (node:internal/process/task_queues:83:21)

Steps to reproduce

No response

Expected behavior

How to fix this issue?

Package

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

Other package

No response

NestJS version

No response

Packages versions

{
  "name": "nestjs",
  "version": "0.0.1",
  "description": "",
  "author": "",
  "private": true,
  "license": "UNLICENSED",
  "scripts": {
    "prebuild": "rimraf dist",
    "build": "nest build",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "start": "nest start",
    "start:dev": "nest start --watch",
    "start:debug": "nest start --debug --watch",
    "start:prod": "node dist/main",
    "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:cov": "jest --coverage",
    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
    "test:e2e": "jest --config ./test/jest-e2e.json"
  },
  "dependencies": {
    "@nestjs/apollo": "^10.0.17",
    "@nestjs/common": "^9.0.0",
    "@nestjs/core": "^9.0.0",
    "@nestjs/graphql": "^10.0.18",
    "@nestjs/mapped-types": "*",
    "@nestjs/platform-fastify": "^9.0.4",
    "apollo-server-fastify": "^3.10.0",
    "graphql": "^16.5.0",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^7.2.0"
  },
  "devDependencies": {
    "@nestjs/cli": "^9.0.0",
    "@nestjs/schematics": "^9.0.0",
    "@nestjs/testing": "^9.0.0",
    "@types/express": "^4.17.13",
    "@types/jest": "28.1.4",
    "@types/node": "^16.0.0",
    "@types/supertest": "^2.0.11",
    "@typescript-eslint/eslint-plugin": "^5.0.0",
    "@typescript-eslint/parser": "^5.0.0",
    "eslint": "^8.0.1",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^4.0.0",
    "jest": "28.1.2",
    "prettier": "^2.3.2",
    "source-map-support": "^0.5.20",
    "supertest": "^6.1.3",
    "ts-jest": "28.0.5",
    "ts-loader": "^9.2.3",
    "ts-node": "^10.0.0",
    "tsconfig-paths": "4.0.0",
    "typescript": "^4.3.5"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "rootDir": "src",
    "testRegex": ".*\\.spec\\.ts$",
    "transform": {
      "^.+\\.(t|j)s$": "ts-jest"
    },
    "collectCoverageFrom": [
      "**/*.(t|j)s"
    ],
    "coverageDirectory": "../coverage",
    "testEnvironment": "node"
  }
}

Node.js version

No response

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@mdalaminbey mdalaminbey added the needs triage This issue has not been looked into label Jul 19, 2022
@jmcdo29
Copy link
Member

jmcdo29 commented Jul 19, 2022

Nest v9 uses fastify v4. The fastify-accepts package you're using only supports up to fastify v3. Replace it with @fastify/accepts and you'll be good to go

@jmcdo29 jmcdo29 closed this as completed Jul 19, 2022
@micalevisk
Copy link
Member

@jmcdo29
Copy link
Member

jmcdo29 commented Jul 19, 2022

Also, I just noticed you have apollo-sever-fastify, that only supports fastify v3, so it may be the root cause of your problem. Just an FYI

@mdalaminbey
Copy link
Author

image
not fixed.

@mdalaminbey
Copy link
Author

@jmcdo29 @micalevisk

@micalevisk
Copy link
Member

run npm ls fastify-accepts

@jmcdo29
Copy link
Member

jmcdo29 commented Jul 19, 2022

Also, I just noticed you have apollo-sever-fastify, that only supports fastify v3, so it may be the root cause of your problem. Just an FYI

This is most likely the issue here. Fastify v4 cannot be used with apollo-server-fastify v3. They are not compatible. This is not related to Nest, it's a problem with the asf package. More on the linked issue

apollographql/apollo-server#6576

@kamilmysliwiec
Copy link
Member

nestjs/graphql#2307

@nestjs nestjs locked and limited conversation to collaborators Jul 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs triage This issue has not been looked into
Projects
None yet
Development

No branches or pull requests

4 participants