request.is is not a function, node_modules/@fastify/middie/lib/engine.js
binoiii opened this issue · comments
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the bug has not already been reported
Fastify version
3.6.2
Plugin version
No response
Node.js version
16
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
10
Description
I am using NestJS with fastify and I am trying to do file upload using graphql-upload.
I have to use the middleware graphqlUploadExpress
where part it has checking,
function graphqlUploadExpressMiddleware(request, response, next) {
if (!request.is("multipart/form-data")) return next();
...
}
Hence, upon making a request an error is being prompted.
{"level":50,"time":1693409667838,"pid":40,"hostname":"a2ab2ffa0249","context":"ExceptionsHandler","err":{"type":"Error","message":"request.is is not a function","stack":"TypeError: request.is is not a function\n at graphqlUploadExpressMiddleware (/usr/src/app/node_modules/graphql-upload-ts/src/graphqlUploadExpress.ts:57:18)\n at Holder.done (/usr/src/app/node_modules/@fastify/middie/lib/engine.js:112:11)\n at Object.run (/usr/src/app/node_modules/@fastify/middie/lib/engine.js:59:12)\n at Object.runMiddie (/usr/src/app/node_modules/@fastify/middie/index.js:73:21)\n at hookIterator (/usr/src/app/node_modules/fastify/lib/hooks.js:353:10)\n at next (/usr/src/app/node_modules/fastify/lib/hooks.js:189:18)\n at hookRunner (/usr/src/app/node_modules/fastify/lib/hooks.js:211:5)\n at Object.routeHandler [as handler] (/usr/src/app/node_modules/fastify/lib/route.js:482:7)\n at Router.callHandler (/usr/src/app/node_modules/find-my-way/index.js:398:14)\n at Router.lookup (/usr/src/app/node_modules/find-my-way/index.js:376:17)"},"msg":"request.is is not a function"}
Steps to Reproduce
"dependencies": {
"@apollo/server": "4.9.0",
"@as-integrations/fastify": "2.1.0",
"@nestjs/apollo": "12.0.7",
"@nestjs/common": "10.1.3",
"@nestjs/config": "3.0.0",
"@nestjs/core": "10.1.3",
"@nestjs/graphql": "12.0.8",
"@nestjs/mongoose": "10.0.1",
"@nestjs/platform-fastify": "10.1.3",
"apollo-server-core": "^3.6.4",
"apollo-server-fastify": "^3.6.2",
"aws-sdk": "2.1437.0",
"express-jwt": "^7.7.7",
"graphql": "16.6.0",
"graphql-upload": "15.0.2",
"graphql-upload-ts": "^2.1.0",
"jwks-rsa": "^3.0.0",
"mongoose": "^6.2.1",
"nestjs-pino": "^2.5.0",
"newrelic": "^9.8.1",
"pino-http": "^6.6.0",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.2.0"
},
Expected Behavior
No response
This is not express, and therefore that middleware is not compatible.