Error starting Ghost after upgrade from 2.38 to 3.22: Cannot read property 'toString' of undefined

I upgraded Ghost from v2.38.2 to latest 3.22.1. Upgrade seemed to proceed ok.

However, I’m unable to start ghost and get the following error:

Message: Cannot read property 'toString' of undefined
Help: Error occurred while executing the following migration: 05-migrate-members-subscription-settings.js

Full error msg, version info etc:

/var/www/ghost$ ghost restart
+ sudo systemctl is-active ghost_mysite-com
Ghost instance is not running! Starting...
+ sudo systemctl start ghost_mysite-com
+ sudo systemctl stop ghost_mysite-com
✖ Starting Ghost
A GhostError occurred.

Message: Cannot read property 'toString' of undefined
Help: Error occurred while executing the following migration: 05-migrate-members-subscription-settings.js
Suggestion: journalctl -u ghost_mysite-com -n 50

Debug Information:
    OS: Ubuntu, v18.04.4 LTS
    Node Version: v10.16.3
    Ghost Version: 3.22.1
    Ghost-CLI Version: 1.14.1
    Environment: production
    Command: 'ghost restart'

I tried to do ghost upgrade --force and there was no change, still got the same behaviour.

Ghost doctor shows no issues as well.

Hey @mtabz, sorry to hear about this.
Please can you share the result of the following DB query?

SELECT `value` 
FROM `settings` 
WHERE `key` = 'members_subscription_settings' \G

:warning: Before posting them please make sure to redact secret_token and public_token values. Thanks!

Sure @Hannah

Here it is:

mysql> SELECT `value`
    -> FROM `settings`
    -> WHERE `key` = 'members_subscription_settings' \G
*************************** 1. row ***************************
value: {"paymentProcessors":[{"adapter":"stripe","config":{"secret_token":"","public_token":"","product":{"name":"Ghost Subscription"},"plans":[{"name":"Monthly","currency":"usd","interval":"month","amount":""},{"name":"Yearly","currency":"usd","interval":"year","amount":""}]}}],"isPaid":false}
1 row in set (0.00 sec) 

There was nothing to redact as I’ve not changed any subscription settings.

Great thank you. I have updated the following issue as your case is very similar:

For now you have 2 options. As you’re not using members, you can remove the row as suggested in the issue above, and then try the upgrade.

Alternatively you can run ghost update 3.20.3 --force to upgrade to the previous version and then do the final upgrade once we fix the issue above.

Ok, as my SQL is very rusty, so just to double-check the command to delete the row would be:

DELETE FROM `settings` WHERE `key` = 'members_subscription_settings';

Have I got that right?

Correct !

Thanks a bunch @Hannah!

With that change I have been able to successfully start Ghost on v3.22.1.

Hey @Hannah, thanks for the workaround. Roughly, where can we expect fixed version, please?
No rush, just wondering.
I hit the same issue upgrading v3.21.0 to v3.22.1.
Cheers.

Hey @stiggy! :wave:

3.22.2 was just released with an improved migration, which should fix the issues you were seeing. Please update using Ghost-CLI :slightly_smiling_face:

1 Like

Grand, works like a charm, thanks! :slight_smile:

Had this issue, as well – but 3.22.2 fixed it :sunglasses: Thanks!