Closed UTC1992 closed 2 years ago
You're using "schema delegation".
What is happening, is when @graphql-tools/delegate
processes the GraphQL request and attempts to forward the Upload
scalar value in another request under the hood to the delegated GraphQL API, it's naively attempting to serialize the value as if it's a regular input object, etc. But Upload
scalar values represent a file upload stream, and can't be instantly serialized to a JSON value. Think about it… how or why would you convert partly streamed binary file data to JSON text? You can't.
I don't know enough about the particular tools you're using to suggest an exact solution; but the tools should document somewhere how to account for this situation. I've seen GraphQL API gateway solutions correctly re-stream the GraphQL multipart request file uploads before.
tanks, @jaydenseric I resolved with information of other post, it resolved removing
Upload: GraphqlUpload // this line was removing of resolvers
This issue has been really driving me up a wall and I looked far and wide for an easy solution, so maybe this will help somebody else. I was able to get my uploads working by switching to importing GraphQLUpload
from the @graphql-tools/links
library instead.
- import { GraphQLUpload } from 'graphql-upload';
+ import { GraphQLUpload } from '@graphql-tools/links';
I have the same problem with this error, help me please with more information // query mutation mutation Mutation($upload: Upload!) { singleUpload(file: $upload) { encoding filename mimetype } }
//response { "errors": [ { "message": "Upload serialization unsupported.", "locations": [ { "line": 2, "column": 3 } ], "path": [ "singleUpload" ], "extensions": { "code": "INTERNAL_SERVER_ERROR", "exception": { "message": "Upload serialization unsupported.", "stacktrace": [ "GraphQLError: Upload serialization unsupported.", " at GraphQLScalarType.serialize (/Users/omar-imac/Desktop/DesarrolloProyectos/1.-1Mentor/pilot-backend/node_modules/graphql-upload/public/GraphQLUpload.js:88:11)", " at /Users/omar-imac/Desktop/DesarrolloProyectos/1.-1Mentor/pilot-backend/node_modules/@graphql-tools/delegate/dist/utils/src/transformInputValue.js:27:57", " at transformInputValue (/Users/omar-imac/Desktop/DesarrolloProyectos/1.-1Mentor/pilot-backend/node_modules/@graphql-tools/delegate/dist/utils/src/transformInputValue.js:8:52)", " at Object.serializeInputValue (/Users/omar-imac/Desktop/DesarrolloProyectos/1.-1Mentor/pilot-backend/node_modules/@graphql-tools/delegate/dist/utils/src/transformInputValue.js:27:12)", " at /Users/omar-imac/Desktop/DesarrolloProyectos/1.-1Mentor/pilot-backend/dist/delegate/src/createRequest.js:59:37", " at Array.forEach ()",
" at createRequest (/Users/omar-imac/Desktop/DesarrolloProyectos/1.-1Mentor/pilot-backend/dist/delegate/src/createRequest.js:55:29)",
" at createRequestFromInfo (/Users/omar-imac/Desktop/DesarrolloProyectos/1.-1Mentor/pilot-backend/dist/delegate/src/createRequest.js:13:12)",
" at Object.delegateToSchema (/Users/omar-imac/Desktop/DesarrolloProyectos/1.-1Mentor/pilot-backend/dist/delegate/src/delegateToSchema.js:12:21)",
" at /Users/omar-imac/Desktop/DesarrolloProyectos/1.-1Mentor/pilot-backend/dist/wrap/src/generateProxyingResolvers.js:64:47"
]
}
}
}
],
"data": null
}