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
fix: file parsing defaultGraohQLTypes.js #7683
base: alpha
Are you sure you want to change the base?
Conversation
Thanks for opening this pull request!
|
Proposed to fix: #7684 |
@brocklj could you please fill out the template? |
837a06a
to
2074ccd
Compare
2074ccd
to
69844b6
Compare
How long could take fix this problem into version |
I removed the TODOs that don't apply to this PR, only the test is missing. Could you please add a test to make sure this bug can't occur again?
The process is to first fix a bug in the
To answer your question exactly, we won't port this into a 4.3.x release (based on the 4.3 version), but we may port it into a 4.x release (based on the latest 4.x version). Portability depends on the required effort. |
Yes, it does. Tested on release 4.10.4. |
The |
Tested on 5.0.0-alpha.5. |
Great, thanks for testing. I changed the target branch of this PR to |
The tests do not pass. Either the tests need to be adapted, or the fix does not work as intended. I suggest to remove the fix for now and just add a failing test to demonstrate the issue. Then add a fix to make the new test pass. |
Hi @brocklj could you provide the GraphQL request that you use in your migrations ? And how you inject your files into the graphQL request ? Feel free to provide your complete request + how you call it ? |
While using apollo-upload-client": "^14.1.3",
The request looks like.
and error message from response:
|
Hi @brocklj I see that the fix is super simple. Could rebase this PR on alpha and add the failing test at the bottom of the ParseGraphQLServer.spec.js You have an example in ParseGraphQLServer.spec.js on how to set up a test with custom definitions and upload a file using multipart upload 🙂 Once it's covered, we can merge 👍 |
Hi @brocklj Parse Server has switched to GraphQL Yoga with new graphql upload/file handling. Could you confirm that the issue is still present in Parse Server last alpha version? Also, could you provide a failing test, it will help to avoid a regression in the future (like the one between 4.2 -> 4.3) |
Tests are failing, there seem to be issues that need to be resolved; removed pending review. This PR is stale for some time; if there is no further activity we'll go ahead and close it. |
Problem with executing GraphQL Cloud code.
Instead of parsing value object type File object is type of Upload
New Pull Request Checklist
Issue Description
This PR solves problems with GraphQL input value of type
File
. After upgrading from version4.2.0
to4.3.0
. All migrations calling cloud code functions with inputs of typeFile
ends with:{ "errors": [ { "message": "Variable \"$input\" got invalid value { resolve: [function], reject: [function], promise: {}, file: { filename: \"ff.jpg\", mimetype: \"image/jpeg\", encoding: \"7bit\", createReadStream: ...Expected type \"File\". [object Object] is not a valid File
Related issue: #7684
Approach
After debbuging the code and searching for where parts throwing exception. Found validation problem in
src/GraphQL/loaders/defaultGraphQLTypes.js
. Parts expecting an object instance ofFile
receivesUpload
. Also__Type
on object is undefined. So I access type name trough constructor.name. After these changes code works as it was before upgrading to4.3.0
.TODOs before merging