Skip to content

Commit a1a5079

Browse files
committed
Ensure the startup is completed before calling startupCompleted
1 parent 20cb333 commit a1a5079

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/ParseServer.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,22 @@ class ParseServer {
8383
// Note: Tests will start to fail if any validation happens after this is called.
8484
databaseController
8585
.performInitialization()
86-
.then(() => hooksController.load())
86+
.then(async () => await hooksController.load())
8787
.then(() => {
88+
if (cloud) {
89+
addParseCloud();
90+
if (typeof cloud === 'function') {
91+
cloud(Parse);
92+
} else if (typeof cloud === 'string') {
93+
require(path.resolve(process.cwd(), cloud));
94+
} else {
95+
throw "argument 'cloud' must either be a string or a function";
96+
}
97+
}
98+
})
99+
.then(async () => {
88100
if (serverStartComplete) {
89-
serverStartComplete();
101+
await serverStartComplete();
90102
}
91103
})
92104
.catch(error => {

0 commit comments

Comments
 (0)