parse-community / parse-server

Parse Server for Node.js / Express
https://parseplatform.org
Apache License 2.0
20.93k stars 4.78k forks source link

GraphQL File Value Parsing Error #7684

Closed brocklj closed 2 weeks ago

brocklj commented 3 years ago

New Issue Checklist

Issue Description

After upgrading from version 4.2.0 to 4.3.0. When I try running cloud code function using GraphQL mutation with input type File.

{ "errors": [ { "message": "Variable \"$input\" got invalid value { resolve: [function], reject: [function], promise: {}, file: { filename: \"ff.jpg\", mimetype: \"image/jpeg\", encoding: \"7bit\", createReadStream: [function createReadStream] } } at \"input[0]\"; Expected type \"File\". [object Object] is not a valid File", "locations": [ { "line": 1, "column": 30 } ], "extensions": { "code": "BAD_USER_INPUT", "exception": { "stacktrace": [ "Error: [object Object] is not a valid File", " at GraphQLScalarType.parseFileValue [as parseValue] (/Users/jakub/development/prins/miwa/dash-api/node_modules/parse-server/lib/GraphQL/loaders/defaultGraphQLTypes.js:318:9)", " at coerceInputValueImpl (/Users/jakub/development/prins/miwa/dash-api/node_modules/graphql/utilities/coerceInputValue.js:129:26)", " at /Users/jakub/development/prins/miwa/dash-api/node_modules/graphql/utilities/coerceInputValue.js:74:16", " at from (<anonymous>)", " at coerceInputValueImpl (/Users/jakub/development/prins/miwa/dash-api/node_modules/graphql/utilities/coerceInputValue.js:72:37)", " at coerceInputValue (/Users/jakub/development/prins/miwa/dash-api/node_modules/graphql/utilities/coerceInputValue.js:39:10)", " at _loop (/Users/jakub/development/prins/miwa/dash-api/node_modules/graphql/execution/values.js:109:69)", " at coerceVariableValues (/Users/jakub/development/prins/miwa/dash-api/node_modules/graphql/execution/values.js:121:16)", " at getVariableValues (/Users/jakub/development/prins/miwa/dash-api/node_modules/graphql/execution/values.js:50:19)", " at buildExecutionContext (/Users/jakub/development/prins/miwa/dash-api/node_modules/graphql/execution/execute.js:205:61)", " at executeImpl (/Users/jakub/development/prins/miwa/dash-api/node_modules/graphql/execution/execute.js:103:20)", " at Object.execute (/Users/jakub/development/prins/miwa/dash-api/node_modules/graphql/execution/execute.js:62:35)", " at /Users/jakub/development/prins/miwa/dash-api/node_modules/apollo-server-core/dist/requestPipeline.js:261:48", " at Generator.next (<anonymous>)", " at /Users/jakub/development/prins/miwa/dash-api/node_modules/apollo-server-core/dist/requestPipeline.js:8:71", " at new Promise (<anonymous>)" ] } } } ] }

Steps to reproduce

Create input mutation with method in Cloud code. Try upload type File.

Actual Outcome

Error occurs. Cannot pass Grapql type validations.

Expected Outcome

Proceeding to cloud code, with File type.

Environment

4.3.0

Server

Database

Logs

parse-github-assistant[bot] commented 3 years ago

Thanks for opening this issue!

brocklj commented 3 years ago

I creates PR with a possible fix of this issue https://github.com/parse-community/parse-server/pull/7683

Moumouls commented 2 weeks ago

@mtrezza i believe it's fixed now ? old version and no more on yoga