Closed javiash closed 1 year ago
This error message is an important clue:
POST body missing, invalid Content-Type, or JSON object has no keys.
The function processRequest
resolves the processed request body that you then need to set somewhere to replace the original request body, but in your code you are not using it.
Here is an example from the Koa middleware:
Hope that helps :)
Hi @jaydenseric ! I did that, but the proccessRequest throws an error before I could asign it to the req.body, or even changing the Content-Type...
wait - compiling /api/graphql (client and server)...
event - compiled successfully in 52 ms (167 modules)
🚀 ~ file: graphql.ts ~ line 22 ~ context: ~ contentType multipart/form-data; boundary=---------------------------90155217136423324944131082892
🚀 ~ file: graphql.ts:37 ~ context: ~ error Error: Unexpected end of form
at Multipart._final (C:\Users\Javier\webDev\proyectosFinales\puntorol\node_modules\.pnpm\busboy@1.6.0\node_modules\busboy\lib\types\multipart.js:588:17)
at callFinal (node:internal/streams/writable:663:25)
at prefinish (node:internal/streams/writable:714:7)
at finishMaybe (node:internal/streams/writable:724:5)
at Multipart.Writable.end (node:internal/streams/writable:631:5)
at onend (node:internal/streams/readable:690:10)
at processTicksAndRejections (node:internal/process/task_queues:78:11)
This is why is getting the POST body missing, invalid Content-Type, or JSON object has no keys.
in the request.
Sorry if there's something that I'm not seeing, and thanks for your reply.
Perhaps investigate one of these tips from the readme:
Promisify and await file upload streams in resolvers or the server will send a response to the client before uploads are complete, causing a disconnect. — https://github.com/jaydenseric/graphql-upload/tree/v16.0.2#tips
Hi, I've tryed a lot to make this work, but still nothing. First I had the exporting issue but now that is working, thanks for all the previous issues and answers. But now I'm getting a
Error: Unexpected end of form
. This is my code:/api/graphql.ts
graphqlClient.ts
resolvers.ts
schema
request
response
package.json
tsconfig.json
I don't know if you need another file to check.
I was using 'apollo-server' v3 with micro and it was working, but as it's now deprecated I wanted to switch to this new version.
Sorry in advanced if the format of this message is way off.