Open yashFP opened 2 years ago
Hi @yashFP, as a start I'd suggest updating to the latest version which is 0.52.0
. What else have you tried to resolve the issue?
@calvincestari still got error
Error :
Received a 400 error. Data returned as a String was: {"errors":[{"message":"Variable \"$input\" got invalid value \"0\" at \"input.files[0]\"; Upload value invalid.","locations":[{"line":1,"column":26}],"extensions":{"code":"BAD_USER_INPUT","exception":{"stacktrace":["GraphQLError: Variable \"$input\" got invalid value \"0\" at \"input.files[0]\"; Upload value invalid."," at /app/node_modules/graphql/execution/values.js:116:15"," at coerceInputValueImpl (/app/node_modules/graphql/utilities/coerceInputValue.js:131:9)"," at /app/node_modules/graphql/utilities/coerceInputValue.js:70:14"," at Array.map (
i am also facing same issue @yashFP
Sorry we haven't gotten back to this one in a while. Firstly, we generally don't recommend doing file uploads via GraphQL. While our client does technically support it, the file upload spec is not fully fleshed out and has issues with a large number of edge cases. You can do file uploads with any other upload mechanism and just send the file names or ids via your GraphQL mutations.
If you are still struggling with this issue, it would be helpful to have a log of the entire HTTP request you are sending. The error logs shown look like the request may be malformed.
Are you still seeing this issue @HardikKardani? We are still struggling to add multiple files when we cannot make them top level parameters to a mutation. Aka we need them nested within an input type.
Bug report
Apollo GraphQL Multiple files not uploading
Write your query or mutation here
mutation createDailyLogs($input: dailyLogsData!) { createDailyLogs(input: $input) {
}
dailyLogsData Inputs : type dailyLogsData { id_job_schedule: String id_daily_log: String note: String date: String files: [Upload]
}
Implementation : let img = (UIImage(named: "image")?.pngData())! let file1 = GraphQLFile(fieldName: "files", originalName: "files1.png", mimeType: "image/png", data: img) let file2 = GraphQLFile(fieldName: "files", originalName: "files2.png", mimeType: "image/png", data: img)
Versions
Please fill in the versions you're currently using:
apollo-ios
SDK version: 0.39.0