Closed shriram10567 closed 3 years ago
The unformatted code is too hard to read; please format it properly in an edit and then I'll take a look:
@shriram1056 I edited your code to be syntax highlighted. Please do that yourself next time, as asked. Also, please edit the markdown link URL for the Stack Overflow link as it's currently broken.
Regarding the Error: Unexpected token P in JSON at position 0
; most likely the response body is a text message from the server. The message starts with P
, so what does it say? You can use the Chrome dev tools network inspector to see the GraphQL response body.
It after that it doesn't become obvious what the problem is, try to figure out if the problem is on the client or server by using the network inspector to see if the outgoing GraphQL request body is a correct GraphQL multipart request.
If it is a client issue, the GitHub issues of this repo is not the right place to ask for help. If it is a server issue, please consult with the Apollo Server community for support. They have a lot of ongoing discussion about their broken support for file uploads in their repos, and Apollo has instructions in their docs for how to get it going.
I'm leaving this issue closed for now, since no evidence of a graphql-upload
bug has been presented.
The issue is related to the output of this error message, thrown by the Server.
POST body missing, invalid Content-Type, or JSON object has no keys.
For some reason, you have an issue and Apollo is trying to build a JSON object, which don't work for a plain text type response.
I guess your server config is wrong.
@shriram1056 I edited your code to be syntax highlighted. Please do that yourself next time, as asked. Also, please edit the markdown link URL for the Stack Overflow link as it's currently broken.
Regarding the
Error: Unexpected token P in JSON at position 0
; most likely the response body is a text message from the server. The message starts withP
, so what does it say? You can use the Chrome dev tools network inspector to see the GraphQL response body.It after that it doesn't become obvious what the problem is, try to figure out if the problem is on the client or server by using the network inspector to see if the outgoing GraphQL request body is a correct GraphQL multipart request.
If it is a client issue, the GitHub issues of this repo is not the right place to ask for help. If it is a server issue, please consult with the Apollo Server community for support. They have a lot of ongoing discussion about their broken support for file uploads in their repos, and Apollo has instructions in their docs for how to get it going.
I'm leaving this issue closed for now, since no evidence of a
graphql-upload
bug has been presented.
I sorry to insert it here, since it was related to graphql-upload can you help me about this issue? https://stackoverflow.com/questions/68850296/apollo-federation-file-upload because I always see you're comments in other ticket of problem about graphql-upload thank you so much
this my apollo client code
on the node server, i have used upload:false as per apollo docs.
this is what my resolver looks like
i am getting the following error: Error: Unexpected token P in JSON at position 0.
P.S. before marking this as closed, please look at this stackoverflow post: https://stackoverflow.com/questions/64971480/cant-upload-files-with-apollo-client-graphql-in-next-js-app-post-body-missing. this post explain the problem better than i have done here