feat: Switch from Yoga v2 to Apollo Server v4
Pull Request
- Report security issues confidentially.
- Any contribution is under this license.
- Link this pull request to an issue.
Issue
Closes: #8728
Approach
- Install graphql upload to support upload
- Install GraphIQL from Yoga team since GraphIQL is standard, and the yoga team graphiql is fine
- Take advantage of X-Parse-Application-Id as CSRF protection https://www.apollographql.com/docs/router/configuration/csrf/
- apollo/server is more focused on NodeJS and have dedicated expressHandler, i hope it will be more stable in complex envs.
- Now we have end to end stream system from client to bucket/storage system through GQL Upload API
- Disable the cache control since it's not used at the moment and can slightly help for performance
- Remove all it_only_node < 17, now upload works on major NodeJS version without issues
- Added mime type package to auto add extension to filename without extension since it's the current behavior, without this we will have a breaking change
Performance tests:
- Checked performance on ParseServerGraphQL test suite and complete test suite in my company with a lot of graphql requests, performance are close and quite the same.
Tasks
- [x] Add tests
- [x] Add changes to documentation (guides, repository pages, code comments)
- [x] Add security check
- [x] Add new Parse Error codes to Parse JS SDK
I will reformat the title to use the proper commit message syntax.
Thanks for opening this pull request!
Codecov Report
Attention: 3 lines in your changes are missing coverage. Please review.
Comparison is base (
80b987d) 94.29% compared to head (7882801) 94.32%.
:exclamation: Current head 7882801 differs from pull request most recent head c9fc40a. Consider uploading reports for the commit c9fc40a to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## alpha #8727 +/- ##
==========================================
+ Coverage 94.29% 94.32% +0.02%
==========================================
Files 186 186
Lines 14785 14809 +24
==========================================
+ Hits 13941 13968 +27
+ Misses 844 841 -3
| Files | Coverage Δ | |
|---|---|---|
| src/GraphQL/ParseGraphQLServer.js | 94.73% <100.00%> (+0.85%) |
:arrow_up: |
| src/GraphQL/loaders/defaultGraphQLTypes.js | 97.78% <100.00%> (-0.01%) |
:arrow_down: |
| src/GraphQL/parseGraphQLUtils.js | 92.00% <100.00%> (ø) |
|
| src/GraphQL/loaders/filesMutations.js | 89.58% <88.88%> (+8.93%) |
:arrow_up: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I notice that this also requires Node 16, so we'll wait with merging info alpha until Nov.
@mtrezza no breaking changen may be the error message of graphql upload, but developers should not rely on message.
Also i added mime type detection, since it's currently supported.
Yes @mtrezza it's not a problem to keep this PR for 2024 :)
Could you suggest an entry for the changelog?
The current title would only be a refactor, but from the PR comment it seems to include many more improvements, so it would be good to add them to the changelog. You don't have to write that into the PR title, I'll add the long version in the commit message and we keep the PR title short.
The label block:major cannot be used here.
@Moumouls While this PR is still "recent" and to prepare it for merging in Nov, do you think you could address the mime dependency issue? Otherwise I'm afraid this PR will go stale and not get merged for a long time if no-one picks it up.
Hi @mtrezza, we should definitely merge this one. It works really well.
What is the mime dep issue. How is it linked to this Pr ?
Just tell me when I need to refresh the branch, and I'll be happy to fix last details to get it merged !
See https://github.com/parse-community/parse-server/pull/8727#discussion_r1313639096.
Nice catch @mtrezza , I'll take a look
Hi @mtrezza i replaced last yoga dep with the CDN version of Apollo Sandbox: https://www.apollographql.com/docs/graphos/explorer/sandbox
Also fixed your feedback to use current mime dep
My team use this branch in production since now 2 months everything works well.
@Moumouls We have begun merging the breaking change PRs for Parse Server 7. Could you please resolve the conflict in this PR so we can merge it?
Closing via https://github.com/parse-community/parse-server/pull/8959