-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Parse Server may expose HTTP routes before complete initialization #7527
Copy link
Copy link
Closed
Labels
block:majorNeeds to be resolved before next major release; remove label afterwardsNeeds to be resolved before next major release; remove label afterwardsstate:breakingBreaking change requires major version increment and `BREAKING CHANGE` commit messageBreaking change requires major version increment and `BREAKING CHANGE` commit messagestate:releasedReleased as stable versionReleased as stable versionstate:released-alphaReleased as alpha versionReleased as alpha versionstate:released-betaReleased as beta versionReleased as beta versiontype:bugImpaired feature or lacking behavior that is likely assumedImpaired feature or lacking behavior that is likely assumed
Metadata
Metadata
Assignees
Labels
block:majorNeeds to be resolved before next major release; remove label afterwardsNeeds to be resolved before next major release; remove label afterwardsstate:breakingBreaking change requires major version increment and `BREAKING CHANGE` commit messageBreaking change requires major version increment and `BREAKING CHANGE` commit messagestate:releasedReleased as stable versionReleased as stable versionstate:released-alphaReleased as alpha versionReleased as alpha versionstate:released-betaReleased as beta versionReleased as beta versiontype:bugImpaired feature or lacking behavior that is likely assumedImpaired feature or lacking behavior that is likely assumed
Type
Fields
Give feedbackNo fields configured for issues without a type.
New Issue Checklist
Issue Description
Currently, all
ParseServerinitialization is done in theconstructorand there is no way to ensure everything is ready before the app is loaded.The main issue(s)
Parse Server constructor will continue to do initialization tasks long after the constructor caller returns, and we have no way to await for its completion.
Server will start to listen to incoming http requests before CloudCode is loaded.
This can be bad in some case because
expressandParseServercan get exposed to the world, before it have completed its initialization leading to client side errorsIdeally, we should refactor the
constructorstartup process into aasync start()method that can be awaited on.Currently we see at occasion during rolling updates clients running cloud functions
Parse.Cloud.run('xyz')and receivingParse.ErrorFunction XYZ does not exists. This is caused by having the parseapimounted andexpressrunning before all Cloud Code have a time to start.A few solutions
(A) Without introducing a BC Break
This solution is great as a compromise for now.. It's simple, and have no long term implications.
Add a
isReady()function that return a promise that is resolved when the constructor has completed(B) Without introducing a BC Break, and a path forward
This solution is great long term solution.
Move constructor init into a
start()method, and add aParseServerOptionautoStart: true. Later in version6.0.0we can defaultautoStarttofalseor ignore/deprecate the parameter(C) Pure and simple BC Break
Just put all constructor code into a
start()and tell users they need to call it in the5.0.0release notes(C) is obvisously a bit harsh 😆 ! LMK what you think and i can submit a PR for either (A) or (B)
Steps to reproduce
Actual Outcome
Expected Outcome
Failing Test Case / Pull Request
Environment
Server
Database
mingorecentgcClient
js4.5.4Logs
Have a good day,
Samuel