parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

feat: Switch from Yoga v2 to Apollo Server v4

Open Moumouls opened this issue 3 years ago • 13 comments

Pull Request

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

Moumouls avatar Aug 31 '23 00:08 Moumouls

I will reformat the title to use the proper commit message syntax.

parse-github-assistant avatar Aug 31 '23 00:08 parse-github-assistant

Thanks for opening this pull request!

parse-github-assistant avatar Aug 31 '23 00:08 parse-github-assistant

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:

... and 1 file with indirect coverage changes

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Aug 31 '23 00:08 codecov[bot]

I notice that this also requires Node 16, so we'll wait with merging info alpha until Nov.

mtrezza avatar Aug 31 '23 00:08 mtrezza

@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 :)

Moumouls avatar Aug 31 '23 01:08 Moumouls

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.

mtrezza avatar Sep 01 '23 23:09 mtrezza

The label block:major cannot be used here.

parse-github-assistant avatar Sep 16 '23 03:09 parse-github-assistant

@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.

mtrezza avatar Sep 16 '23 11:09 mtrezza

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 !

Moumouls avatar Sep 16 '23 12:09 Moumouls

See https://github.com/parse-community/parse-server/pull/8727#discussion_r1313639096.

mtrezza avatar Sep 16 '23 14:09 mtrezza

Nice catch @mtrezza , I'll take a look

Moumouls avatar Sep 18 '23 06:09 Moumouls

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 avatar Oct 29 '23 11:10 Moumouls

@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?

mtrezza avatar Dec 25 '23 19:12 mtrezza

Closing via https://github.com/parse-community/parse-server/pull/8959

mtrezza avatar Mar 02 '24 01:03 mtrezza