-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
feat: Upgrade to express 5.0.1 #9530
base: alpha
Are you sure you want to change the base?
Conversation
Thanks for opening this pull request! |
f49e9a7
to
77e2535
Compare
I will reformat the title to use the proper commit message syntax. |
Nice! It seems there are no breaking changes for developers in this PR, correct? I've started the CI. |
@mtrezza I don't believe there are any! I also ran my app server's integration tests against the new build and they all passed. |
Do you know whether there are any effects on Parse Server that come with the upgrade? If there are no known effects, then we could merge this as a refactor (just like we do with any other dependency upgrade), which would not trigger a release. |
That kinda depends on what you mean by effects. I haven't nailed down exactly why, but I haven't been able to update my app's version of Express to 5 without Parse crashing ( I'm seeing some errors in the tests that I was't seeing before so once those are fixed it I might find some more effects that would make the decision easier. |
I've marked this as a breaking change as a precaution; more analysis is needed before we can merge this and know whether it actually is a breaking change, or what its effects are.
|
That's fair, @mtrezza . To answer your one question though, I have tested this against a implementation running Express 4 without any issues so I believe this change will stay compatible with 4.x. |
@mtrezza ok I've made a number of changes to get all of the tests passing and will update the PR description to reflect this. I still have not found anything that I would consider a breaking change, but these are the remaining things I found:
|
Good investigation, I've started the CI. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## alpha #9530 +/- ##
=======================================
Coverage 93.50% 93.51%
=======================================
Files 186 186
Lines 14807 14809 +2
=======================================
+ Hits 13845 13848 +3
+ Misses 962 961 -1 ☔ View full report in Codecov by Sentry. |
@mtrezza all of the tests passed except for a series of 8 that failed for issues related to a bad cert.
Any idea what that's about? The code coverage in that report also seems fine to me but let me know what you think. I don't really think we need a test to cover that tiny conditional, but let me know if you feel differently! |
Pull Request
Issue
Closes: #9353
Approach
Express 5 is not a huge change from 4, but it does introduce some breaking changes and deprecates body-parser (well technically that was replaced in a later version of 4, but I decided to clean it up in this PR anyway). Here are the main changes that impacted Parse Server in this upgrade and how I addressed them:
router
. In Parse, path parameter validation is done using an Express class called Layer which is now in thatrouter
package so I added the new package and updated the import.req.body
is nowundefined
if the body has not been parsed OR if there is no body. Previously, it returned an empty object. Because Parse attempts to access keys onbody
without verifying that it exists, I had to go through and update all unsafe reference attempts or places wherebody
was passed to a function.body-parser
has been replaced with nativeexpress
functions. Updating this just meant swappingbodyParser
withexpress
and removing the package.urlencoded
now defaults tofalse
. I decided against removing the explicit setting of that property inParseServer.js
as a personal preference for more explicit declarations. It is no longer technically necessary though.I also updated the package.json test scripts to use MongoDB 6.0.2 because 5.3.2 doesn't exist and you'll get an error if you try to run a test locally with that version.
Testing
The Express migration guide and release announcement was used to validate breaking changes: