-
Notifications
You must be signed in to change notification settings - Fork 308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File Upload Not Working #242
Comments
same issue here, let me know if you solved it please ! |
Update latest version fixed the issue |
For me the version |
@lynxtaa I saw that you had a PR #175 for Upload spec support. I am at the point where I'm trying to upload a file, via the As it pertains to this issue, and PR #175, do you have an example on how to use the GraphQLClient, and typescript-graphql-request to upload a file? This might be best solved with some solution to #242 ?... I'm faced with the same (similar) issue as @shadyendless . The incoming request nullifies the file data:
Similarly, if I follow https://github.com/prisma-labs/graphql-request#file-upload, I get an unexpected token error,
@guiquintelas This downgrade did not work for me, neither did an upgrade to v3.5.0. |
@gblikas In graphql-request there is a heuristic for detecting files in variables https://github.com/prisma-labs/graphql-request/blob/a6d1365ae0fc6694c45ea404e4a44b93a8c06479/src/createRequestBody.ts#L10 it supports instances of File and Blob and duck-types NodeJS streams. Does it work without Sorry, I don't have any examples because right now I'm using my own implementation of graphql client and not using graphql-request |
@lynxtaa I poked around with works without has a
ℹ️ FYI, Postman does send through a valid File, and Upload, via @lynxtaa After taking your comments into consideration, and using
Perhaps, @jaydenseric can shed some light on this issue? Here are the relevant packages I'm using,
Although I installed I also found some other github issues that seem to be related to this one (or legacy solutions, which have not proved helpful); jaydenseric/graphql-upload#241, jaydenseric/graphql-upload#238 |
@gblikas use the Chrome inspector network tab to double check the client is sending a valid GraphQL multipart request.
Do you mean to say the files upload and are processed by the GraphQL API correctly when you do the file upload requests via Postman? In that case you problem is not the server; the client is not sending valid requests.
Uninstall it. Why bloat your
Remove that config that does nothing. |
@jaydenseric Yes, this seems to be the case; this is why the issue is in |
@gblikas Could you create a repository with a minimal reproduction of this issue? I'll look into it P.S. |
Also I noticed that |
@lynxtaa sorry that it took so long! Here is a very bare-bones implementation of the error in question; it was based on the graphql-upload example code,
Let me know if you're able to reproduce this error. |
Check out https://codesandbox.io/s/unruffled-paper-rxxct?file=/test.ts |
@lynxtaa The sandbox worked great. I'll take a moment to integrate this in to our internal framework, and get back with a confirmation of it working. @lynxtaa For next time, where could I have found better documentation around how to upload a file using graphql-request? Uploading a file progamatically, via |
@gblikas I'm glad it helped!
You can check out sources, they are rather minimal https://github.com/prisma-labs/graphql-request/tree/master/src Under the hood graphql-request uses extract-files to detect streams, Blobs and Files in variables and change request body to a multipart/form-data according to a GraphQL File Upload spec |
@shadyendless Did the solution @lynxtaa and I have been discussing help solve your current problem? |
Hi there, maybe it's obvious to others but since I spent sometime figuring out why my generated sdk client cannot upload file I will describe what happened to me here:
It seems the |
Hello!
I recently switched from Apollo Client over to graphql-request because of my switch to using SWR for all of our requests. As part of this switch, file uploads appear to have broken across the site.
Following the documentation on the front of the page does not appear to make things work as intended.
Here is my query:
And here are the variables that are being sent along (as copy/pasted from my browser console):
The issue is that the request that is being sent to the server does not indicate that it has any files or anything of the like.
Headers
Payload
Any assistance is greatly appreciated here.
The text was updated successfully, but these errors were encountered: