-
Notifications
You must be signed in to change notification settings - Fork 731
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
Upload not working to Apollo Server using v0.13.0 #698
Comments
Firstly, please check out #695 to see if any of the suggestions there help you. If they do, you can skip the rest of this, just let us know what helped. If they don't, I have a few questions for you:
|
Hi, @designatednerd ! This was a trial and error... I've tried with upload Input as well, as you can see here... /// SWIFT
// MUTATION /// ERRORS I really appreciate your help! |
Hey - so looking at the stack trace, the server is throwing an error in Ruby here. What server are you using - the whole Apollo Server is written in JS, so it's some other GraphQL server. I believe as I indicated in #695 you'll need to talk to your backend dev - I didn't realize when I replied last night that you'd also started that issue as well. Can we pick one of these issues to focus on please? |
Hello! I'm struggling to make a file upload to a server, I've opened this issue to report everything steps, from IOS to the Apollo Server logs:
To show that our GQL Server is compliant with the standard here is a success CURL real example:
/// APOLLO SERVER
curl http://madari-staging.herokuapp.com/graphql
-F operations='{ "query": "mutation($image: Upload!, $clientId: String!, $clientSecret: String!) { uploadFile( input: { file: $image clientId: $clientId, clientSecret: $clientSecret } ) { errors attachment { id } } }", "variables": { "clientId": "fGwoCunPSgA0uDnaW8I_NhMtOemN-zYuEb6HKaMlfvs", "clientSecret": "wFQkIOYzrAh6ulcJLTEvKQjW4aP5hBAPWzNxw5j7pQw", "image": null } }'
-F map='{ "0": ["variables.image"] }'
-F 0=@oren\ Logo.png
That hit a real public test server with a custom ID and Secret we made it for you to be able to test so, fell free to run that any time.
For comparison reasons, the above shows the following log on the Rails Server:
019-08-07T18:15:45.805200+00:00 app[web.1]: I, [2019-08-07T18:15:45.805101 #4] INFO -- : [cf2ffd25-3124-4752-81df-fcee3ce30cd1] Processing by Public::GraphqlController#execute as /
2019-08-07T18:15:45.805448+00:00 app[web.1]: I, [2019-08-07T18:15:45.805334 #4] INFO -- : [cf2ffd25-3124-4752-81df-fcee3ce30cd1] Parameters: {"operations"=>"{ "query": "mutation($image: Upload!, $clientId: String!, $clientSecret: String!) { uploadFile( input: { file: $image clientId: $clientId, clientSecret: $clientSecret } ) { errors attachment { id } } }", "variables": { "clientId": "fGwoCunPSgA0uDnaW8I_NhMtOemN-zYuEb6HKaMlfvs", "clientSecret": "wFQkIOYzrAh6ulcJLTEvKQjW4aP5hBAPWzNxw5j7pQw", "image": null } }", "map"=>"{ "0": ["variables.image"] }", "0"=>#<ActionDispatch::Http::UploadedFile:0x00007ffa8c869f50 @tempfile=#Tempfile:/tmp/RackMultipart20190807-4-16tyea8.png, @original_filename="Oren Logo.png", @content_type="application/octet-stream", @headers="Content-Disposition: form-data; name="0"; filename="Oren Logo.png"\r\nContent-Type: application/octet-stream\r\n">, "query"=>"mutation($image: Upload!, $clientId: String!, $clientSecret: String!) { uploadFile( input: { file: $image clientId: $clientId, clientSecret: $clientSecret } ) { errors attachment { id } } }", "variables"=>{"clientId"=>"fGwoCunPSgA0uDnaW8I_NhMtOemN-zYuEb6HKaMlfvs", "clientSecret"=>"wFQkIOYzrAh6ulcJLTEvKQjW4aP5hBAPWzNxw5j7pQw", "image"=>#<ActionDispatch::Http::UploadedFile:0x00007ffa8c869f50 @tempfile=#Tempfile:/tmp/RackMultipart20190807-4-16tyea8.png, @original_filename="Oren Logo.png", @content_type="application/octet-stream", @headers="Content-Disposition: form-data; name="0"; filename="Oren Logo.png"\r\nContent-Type: application/octet-stream\r\n">}}
........
2019-08-07T18:15:46.777150+00:00 app[web.1]: I, [2019-08-07T18:15:46.777065 #4] INFO -- : [cf2ffd25-3124-4752-81df-fcee3ce30cd1] [ActiveJob] Enqueued ActiveStorage::AnalyzeJob (Job ID: 3a71cfa8-e599-49ea-b013-da68f3e26ea3) to Async(default) with arguments: #<GlobalID:0x00007ffa8c6c1bd0 @uri=#<URI::GID gid://madari/ActiveStorage::Blob/58>>
2019-08-07T18:15:46.779655+00:00 app[web.1]: I, [2019-08-07T18:15:46.779570 #4] INFO -- : [cf2ffd25-3124-4752-81df-fcee3ce30cd1] Completed 200 OK in 974ms (Views: 0.3ms | ActiveRecord: 18.6ms)
////// IOS
let fileFieldName = "file"
let file = GraphQLFile(fieldName: fileFieldName, originalName: fileFieldName, mimeType: "image/jpeg", data: imageData)
Hope you can help me with that... Thanks a lot!!!
The text was updated successfully, but these errors were encountered: