Ghost Debugging 1: Overview
This is the first of a series of pages about debugging a Ghost publishing platform running on virtual private server.
There are six posts in the series:
- Overview (this page)
- Remote Development Setup
- Stepping Through Code
- SMTP Email Bug
- Capturing Network Packets
- Dealing with SMTP
Rough notes are found at Notion Ghost Email Bug .
Description of issue
In Ghost 5.47.1, when user tries to sign up, confirmation email is not sent because of wrong sender. Ghost is not honoring the from
field in the mail configuration object found in /var/www/ghost/configuration.development.json
Ghost reports SMTP rejection because of wrong sender. Inspection shows noreply@notes.nodeholder.com but config.production.json
has correct address (info@nodeholder.com).
Getting oriented
Login to Ghost server
Ghost runs in either production or development mode. First, login to your server, this assumes you are using a SSH key in server:/root/.ssh/authorized_keys
.
Config /var/www/ghost
config.development.json
- used when starting ghost from cliconfig.production.json
- used by systemctlcurrent
- symbolic link to 5.47.1versions/5.47.1
- code that runs in dev and production
Production
The production mode is configured by config.production.json
and is managed by a systemctl configuration found in /lib/systemd/system/ghost_notes-nodeholder-com.service
.
Configuration information is found in the working directory, called config.production.json
found in /var/www/ghost
.
Let's first confirm we are running in production using ghost ls
:
Alternatively, using systemctl status
:
Capture production logging via journalctl:
The man page for journalctl which prints log entries from systemd journal, abbreviated from original output found in Notion task, but essentially:
Analysis
Sending email failed because the sender address noreply@ notes.nodeholder.com
was not owned by the user info@nodeholder.com
, leading to a rejection of all recipients. The error, identified by code EENVELOPE and ID 442f8810-1e40-11ee-aa87-ad8c802d6d4b, occurred during a "POST /members/api/send-magic-link/" request, which returned a 400 status code.
The mail server reports that recipient was rejected because the sending agent was not owned by info@nodeholder.com
. This is because it received noreply@notes.nodeholder.com
.
We see that this is response to an HTTP request POST /members/api/send-magic-link/
which was handled by nodemailer/lib/smtp-connection/index.js
.
See Ghost Debugging 2: Remote development setup for configuring a remote debugging session so we can take a closer look.