Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions ghost/core/core/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,12 @@ async function initServices() {
debug('Begin: initServices');

debug('Begin: Services');
// NOTE: If you need to add dependencies for services, use npm install <package>
const identityTokens = require('./server/services/identity-tokens');
const stripe = require('./server/services/stripe');
const members = require('./server/services/members');
const tiers = require('./server/services/tiers');
const permissions = require('./server/services/permissions');
const xmlrpc = require('./server/services/xmlrpc');
const slack = require('./server/services/slack');
const webhooks = require('./server/services/webhooks');
const scheduling = require('./server/adapters/scheduling');
Expand Down Expand Up @@ -347,9 +347,9 @@ async function initServices() {
await stripe.init();

// NOTE: newsletter service and email service depend on email address service
await emailAddressService.init(),

await Promise.all([
emailAddressService.init(),
identityTokens.init(),
memberAttribution.init(),
Comment on lines 351 to 354
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the file structure and context around emailAddressService.init()
cat -n ghost/core/core/boot.js | sed -n '340,370p'

Repository: agentic-review-benchmarks/Ghost-combined-coderabbit

Length of output: 1285


🏁 Script executed:

#!/bin/bash
# Search for emailAddressService references and dependencies
rg -n "emailAddressService" --type=js -B2 -A2

Repository: agentic-review-benchmarks/Ghost-combined-coderabbit

Length of output: 34084


🏁 Script executed:

#!/bin/bash
# Search for services that might depend on emailAddressService during init
rg -n "\.init\(\)" --type=js -B1 -A1 | head -100

Repository: agentic-review-benchmarks/Ghost-combined-coderabbit

Length of output: 6996


Move emailAddressService.init() outside of Promise.all to ensure it completes before emailService initializes.

Line 349 explicitly documents that the email service depends on emailAddressService being ready. Currently, both are initialized in parallel within Promise.all (lines 352 and 365), which creates a race condition. emailService.init() may start before emailAddressService.init() completes.

Correct ordering
-    await Promise.all([
-        emailAddressService.init(),
-        identityTokens.init(),
+    await emailAddressService.init();
+    await Promise.all([
+        identityTokens.init(),
         memberAttribution.init(),
         mentionsService.init(),
         mentionsEmailReport.init(),
         staffService.init(),
         members.init(),
         tiers.init(),
         tagsPublic.init(),
         postsPublic.init(),
         membersEvents.init(),
         permissions.init(),
         audienceFeedback.init(),
         emailService.init(),
         emailAnalytics.init(),
         webhooks.listen(),
         scheduling.init(),
         comments.init(),
         linkTracking.init(),
🤖 Prompt for AI Agents
In `@ghost/core/core/boot.js` around lines 351 - 354, The
emailAddressService.init() call is being started in parallel inside Promise.all
causing a race with emailService.init(); remove emailAddressService.init() from
the Promise.all and invoke await emailAddressService.init() before the
Promise.all block so emailAddressService.init() completes prior to calling
emailService.init(), leaving the remaining initializers (identityTokens.init,
memberAttribution.init, etc.) inside Promise.all as before.

mentionsService.init(),
Expand All @@ -361,15 +361,11 @@ async function initServices() {
postsPublic.init(),
membersEvents.init(),
permissions.init(),
xmlrpc.listen(),
slack.listen(),
audienceFeedback.init(),
emailService.init(),
emailAnalytics.init(),
webhooks.listen(),
scheduling.init({
apiUrl: urlUtils.urlFor('api', {type: 'admin'}, true)
}),
scheduling.init(),
comments.init(),
Comment on lines 366 to 369
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check scheduling adapter init signature and all call sites
rg -n -C3 "scheduling\.init\(" --type=js
rg -n -C3 "adapters/scheduling" --type=js

Repository: agentic-review-benchmarks/Ghost-combined-coderabbit

Length of output: 7636


🏁 Script executed:

#!/bin/bash
# Find the scheduling adapter entry point and check init signature
find ghost/core/core/server/adapters/scheduling -name "index.js" -o -name "*.js" | head -20
cat ghost/core/core/server/adapters/scheduling/index.js 2>/dev/null || echo "index.js not found"
ls -la ghost/core/core/server/adapters/scheduling/

Repository: agentic-review-benchmarks/Ghost-combined-coderabbit

Length of output: 1439


🏁 Script executed:

#!/bin/bash
# Check post-scheduling module and its usage
cat ghost/core/core/server/adapters/scheduling/post-scheduling/index.js

# Search for ALL scheduling.init calls to see call pattern consistency
rg -n "scheduling\.init" --type=js -A2 -B2

# Check for any other references to scheduling service
rg -n "\.init\(\)" ghost/core/core/boot.js | head -20

Repository: agentic-review-benchmarks/Ghost-combined-coderabbit

Length of output: 2607


Fix scheduling.init() call - missing required options argument.

The adapter's init() function at ghost/core/core/server/adapters/scheduling/index.js requires an options parameter with an apiUrl property. The call at line 368 passes no arguments, causing a runtime error when the post-scheduling module tries to access options.apiUrl. Provide the required options object or make the parameter optional with a default value.

🤖 Prompt for AI Agents
In `@ghost/core/core/boot.js` around lines 366 - 369, scheduling.init() is being
called without the required options object (the adapter at
core/server/adapters/scheduling/index.js expects options.apiUrl), which causes a
runtime error; fix by passing a proper options object when calling
scheduling.init() from core/boot.js that includes apiUrl (e.g., derive it from
the existing site/config URL used elsewhere), or alternatively update the
scheduling adapter's init(options) signature to accept an optional parameter and
default options.apiUrl to a sensible value to avoid dereferencing undefined —
reference scheduling.init() and the adapter at
core/server/adapters/scheduling/index.js when making the change.

linkTracking.init(),
emailSuppressionList.init(),
Expand Down
134 changes: 0 additions & 134 deletions ghost/core/core/server/services/xmlrpc.js

This file was deleted.

1 change: 0 additions & 1 deletion ghost/core/core/shared/config/env/config.development.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"contentPath": "content/"
},
"privacy": {
"useRpcPing": false,
"useUpdateCheck": true
},
"useMinFiles": false,
Expand Down
Loading