graphql-compose
graphql-compose copied to clipboard
Error when using GraphQLUpload from graphql-upload
Hello @nodkz, see if is possible help us.
The GraphQLUpload const type is GraphQLScalarType from the graphql package, but the class does not have the type attribute. However the ObjectTypeComposer.ts class has the type attribute. So during the build process we are getting this error:
Type 'GraphQLScalarType<unknown, unknown>' is not assignable to type 'ObjectTypeComposerArgumentConfig | ObjectTypeComposerArgumentConfigDefinition'.
Property 'type' is missing in type 'GraphQLScalarType<unknown, unknown>' but required in type 'ObjectTypeComposerArgumentConfigAsObjectDefinition'.ts(2322)
ObjectTypeComposer.d.ts(58, 5): 'type' is declared here.
It's my package.json
{
"name": "nestjs-graphql-best-practice",
"version": "1.0.1",
"description": "Nestjs GraphQL Best Practice",
"author": "Chnirt",
"license": "MIT",
"engines": {
"node": ">=12 <16"
},
"keywords": [
"nestjs",
"bootstrap",
"express",
"apollo-graphql",
"mongoose",
"typegoose",
"graphql-compose-mongoose"
],
"scripts": {
"add": "cd scripts && node create-resource.js && cd ..",
"cs": "cd scripts && node create-service.js && cd ..",
"cr": "cd scripts && node create-repository.js && cd ..",
"build": "tsc -p tsconfig.build.json",
"format": "prettier --write \"src/**/*.ts\"",
"start": "ts-node -r tsconfig-paths/register src/main.ts",
"start:dev": "nodemon",
"start:debug": "nodemon --config nodemon-debug.json",
"start:prod": "NODE_ENV=production node -r ./tsconfig-paths-bootstrap.js dist/main.js",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"lint:fix": "tslint --fix -p tsconfig.json -c tslint.json",
"test": "NODE_ENV=testing jest -w 1 --config ./jest.config.json --forceExit",
"test:watch": "NODE_ENV=testing jest -w 1 --watch --forceExit",
"test:cov": "NODE_ENV=testing jest -w 1 --config ./jest.config.json --coverage --forceExit",
"test:debug": "NODE_ENV=testing node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest -w 1 --runInBand --forceExit",
"test:e2e": "NODE_ENV=testing jest -w 1 --config ./test/jest-e2e.json --forceExit",
"webpack": "webpack --config webpack.config.js",
"start:hmr": "node dist/main.js",
"gen": "ts-node src/generator/generate-typings.ts",
"db:seed": "ts-node src/dbseed.ts",
"doc": "npx compodoc --port 11045 -p tsconfig.json -s",
"doc:serve": "yarn doc && npx compodoc -s",
"heroku-postbuild": "yarn --only=dev --no-shrinkwrap && yarn build && yarn gen",
"now-build": "yarn --only=dev --no-shrinkwrap && yarn build && yarn gen",
"dump": "ts-node src/dump",
"coveralls": "cat ./coverage/lcov.info | node node_modules/.bin/coveralls"
},
"dependencies": {
"@apollo/federation": "^0.10.2",
"@apollo/gateway": "^0.10.8",
"@firebase/app-compat": "^0.1.10",
"@google-cloud/translate": "^6.3.0",
"@nestjs/bull": "^0.4.2",
"@nestjs/common": "^8.2.3",
"@nestjs/core": "^8.2.3",
"@nestjs/event-emitter": "^1.0.0",
"@nestjs/graphql": "^8.0.2",
"@nestjs/microservices": "^8.0.7",
"@nestjs/platform-express": "^8.2.3",
"@nestjs/schedule": "^1.0.2",
"@typegoose/typegoose": "^8.2.0",
"acorn": "^6.4.2",
"apollo-server": "^2.9.9",
"apollo-server-cache-memcached": "^0.6.3",
"apollo-server-express": "^2.9.7",
"apollo-server-plugin-response-cache": "^0.3.5",
"assert": "^2.0.0",
"axios": "^0.19.0",
"bcrypt": "^3.0.6",
"bull": "^3.29.3",
"cache-manager": "^2.10.0",
"chai": "^4.2.0",
"chalk": "^4.1.0",
"change-case": "^4.1.2",
"class-transformer": "^0.2.3",
"class-validator": "^0.13.1",
"cloudinary": "1.16.0",
"compression": "^1.7.4",
"cron": "^1.7.2",
"csurf": "^1.10.0",
"dateformat": "^3.0.3",
"dotenv": "^8.2.0",
"email-validator": "^2.0.4",
"express-rate-limit": "^5.0.0",
"firebase-admin": "^10.0.0",
"fs": "0.0.2",
"graphql": "^14.5.8",
"graphql-compose": "^9.0.4",
"graphql-compose-mongoose": "^9.7.0",
"graphql-depth-limit": "^1.1.0",
"graphql-query-complexity": "^0.9.0",
"graphql-rate-limit": "^2.0.1",
"graphql-redis-subscriptions": "^2.4.0",
"graphql-tools": "^4.0.5",
"graphql-type-json": "^0.3.0",
"graphql-upload": "^12.0.0",
"graphql-voyager": "^1.0.0-rc.28",
"handlebars": "^4.4.5",
"helmet": "^3.21.2",
"ioredis": "^4.14.1",
"jest-config": "^24.9.0",
"jsonwebtoken": "^8.5.1",
"libphonenumber-js": "^1.9.38",
"merge-graphql-schemas": "^1.7.0",
"moment": "^2.29.1",
"mongodb": "^3.3.3",
"mongoose": "^5.13.8",
"morgan": "^1.9.1",
"multer": "^1.4.2",
"nest-winston": "^1.6.0",
"nestjs-i18n": "^8.1.6",
"nodemailer": "^6.3.1",
"nodemailer-express-handlebars": "^3.1.0",
"passport": "^0.4.0",
"passport-facebook": "^3.0.0",
"passport-facebook-token": "^3.3.0",
"passport-google-oauth": "^2.0.0",
"passport-google-plus-token": "^2.1.0",
"passport-google-token": "^0.1.2",
"pluralize": "^8.0.0",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"redis": "^3.1.2",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.0",
"rxjs": "7.4.0",
"stripe": "^8.132.0",
"tsconfig-paths": "^3.9.0",
"uuid": "^3.3.3",
"webpack-bundle-analyzer": "^3.6.0",
"winston": "^3.2.1"
},
"devDependencies": {
"@compodoc/compodoc": "^1.1.11",
"@nestjs/testing": "^8.2.3",
"@types/bull": "^3.15.6",
"@types/express": "^4.17.1",
"@types/graphql-upload": "^8.0.7",
"@types/jest": "^24.0.19",
"@types/jsonwebtoken": "^8.5.5",
"@types/node": "^12.11.1",
"@types/nodemailer": "^6.2.1",
"@types/pluralize": "0.0.29",
"@types/stripe": "^7.10.7",
"@types/supertest": "^2.0.8",
"@typescript-eslint/eslint-plugin": "^4.14.1",
"@typescript-eslint/parser": "^4.14.1",
"codecov": "^3.6.1",
"concurrently": "^5.0.0",
"coveralls": "^3.0.7",
"eslint": "^5.16.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-import": "^2.20.1",
"fs-extra": "^10.0.0",
"husky": "^3.0.9",
"jest": "^24.9.0",
"lint-staged": "^9.4.2",
"ncp": "^2.0.0",
"nodemon": "^1.19.4",
"prettier": "^1.19.1",
"progress-bar-webpack-plugin": "^1.12.1",
"supertest": "^4.0.2",
"ts-jest": "^24.1.0",
"ts-loader": "^6.2.0",
"ts-morph": "12.2.0",
"ts-node": "^8.4.1",
"tslint": "^5.20.0",
"tslint-clean-code": "^0.2.10",
"tslint-config-prettier": "^1.18.0",
"typescript": "4.3.5",
"wait-on": "^3.3.0",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.9",
"webpack-loader-helper": "^1.0.0",
"webpack-node-externals": "^1.7.2",
"yarn": "^1.19.1"
},
"lint-staged": {
"*.ts": [
"yarn format",
"git add"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
}
@rafaneri please did you resolve your issue ? having problems with typeDef for uploads....
Make sure you use "@types/graphql-upload": "8.0.8"
. Versions starting from 8.0.9
has "graphql": "^16.2.0"
as dependency, which has a different type signature.
I had the same problem, downgraded to 8.0.8
and it works.
@lewatt23, I did the same as @geiszla. Downgrade the "@types/graphql-upload"
to "@types/graphql-upload": "8.0.8"
Thanks