prisma-labs / graphql-framework-experiment

Code-First Type-Safe GraphQL Framework
https://nexusjs.org
MIT License
672 stars 66 forks source link

Missing multipart field ‘operations’ (and other related errors) #1413

Closed steinathan closed 4 years ago

steinathan commented 4 years ago

Nexus Report

{
  "node": "v14.8.0",
  "os": {
    "platform": "linux",
    "release": "5.4.0-26-generic"
  },
  "nexus": "^0.26.1",
  "plugins": [
    "nexus-plugin-prisma",
    "nexus-plugin-shield"
  ],
  "otherDependencies": {
    "@types/jsonwebtoken": "^8.5.0",
    "axios": "^0.20.0",
    "bcryptjs": "^2.4.3",
    "cors": "^2.8.5",
    "cron": "^1.8.2",
    "date-fns": "^2.16.1",
    "file-type": "^15.0.0",
    "graphql-upload": "^11.0.0",
    "jsonwebtoken": "^8.5.1",
    "mediasoup": "^3.6.16",
    "socket.io": "^2.3.0"
  },
  "devDependencies": {},
  "hasAppModule": true,
  "packageManager": "npm",
  "errorsWhileGatheringReport": {
    "gettingLayout": null,
    "gettingPluginManifests": null
  }
}

Screenshots

Screenshot from 2020-09-12 22-44-47 Screenshot from 2020-09-12 22-44-04

Description

From the docs https://nexusjs.org/components-standalone/schema/api/api-scalarType#example-of-upload-scalar the export const Upload = GraphQLUpload doesn't work at all but in the api.graphql there's a NEXUS__UNKNOWN__TYPE somewhere but when i changed it to schema.scalarType(GraphQLUpload) it worked but then I keep getting this error

■ nexus:server:graphql Missing multipart field ‘operations’ (https://github.com/jaydenseric/graphql-multipart-request-spec).
[object Object]

But am sure am sending the right params

operations: {"variables":{"file":null},"query":"mutation ($file: Upload!) {\n  uploadEventMedia(file: $file) {\n    id\n    path\n    __typename\n  }\n}\n"}
map: {"1":["variables.file"]}
1: (binary)

but ive also noticed this from $ npm ls

├── graphql-upload@11.0.0 
└─┬ nexus@0.26.1
  └─┬ apollo-server-express@2.16.1
    └─┬ apollo-server-core@2.16.1
      └── graphql-upload@8.1.0 

nexus is using apollo-server-express that in turn uses an old version of graphql-upload

steinathan commented 4 years ago

Fixed, i upgraded my nexus version to ^0.27.0-next.7, and removed the express middleware:

server.express.use(
  '/graphql',
  graphqlUploadExpress({ maxFileSize: 10000000, maxFiles: 5 }),
)

from my app.ts, forcibly bumped graphql-upload and added

  "resolutions": {
    "graphql-upload": "^11.0.0"
  },

to my package.json and everything worked