An error occurred. Response code 500 running ghost backup

If you’re looking for help, please provide information about your environment. If you delete this template and don’t provide any information, your topic will be automatically closed.

If you aren’t running the latest version of Ghost, the first thing we’ll ask you to do is update to the latest version of Ghost.

And

  • How was Ghost installed and configured? Digital Ocean pre-configured droplet.

  • What Node version, database, OS & browser are you using? Node: v18.20.8, database: MySQL, looking for version number, OS: Ubuntu v22.04.5 LTS, Browser: Firefox 141.0

  • When running ghost backup from the command line as my non-root ghost user, The backup errors out with Response code 500 (Internal Server Error). Log below:

  • Debug Information:OS: Ubuntu, v22.04.5 LTSNode Version: v18.20.8Ghost Version: 5.130.2Ghost-CLI Version: 1.27.0Environment: productionCommand: ‘ghost backup’An error occurred.Message: ‘Response code 500 (Internal Server Error)’
    
    Stack: HTTPError: Response code 500 (Internal Server Error)at EventEmitter. (/usr/lib/node_modules/ghost-cli/node_modules/got/source/as-promise.js:74:19)at process.processTicksAndRejections (node:internal/process/task_queues:95:5)Path: /ghost/api/admin/session/
    
  • What steps could someone else take to reproduce the issue you’re having?

  • Attempt to run the ghost backup command.

Are you on the latest CLI version? If not, please update to the latest version and try again :slightly_smiling_face:

Thanks @vikaspotluri123,

My Ghost-CLI version is 1.27.0.

How can I tell if that’s the latest for Ghost version 5.130.2?

You can check for the latest version on GitHub here:

You are using an old Ghost-CLI version. You can update it by logging into your server and running:

sudo npm install -g ghost-cli@latest

Which is listed in the docs here:

Also if you are going to be sticking to Ghost 5, then 5.130.3 is the most current release of that version. You can upgrade to that version by logging into your server, navigating to your ghost site’s directory, and running:

ghost update 5.130.3

As outlined here:

Thanks @ghostdan,

I’m preparing to upgrade to Ghost 6 once 6.0.1 is out. That’s why I want to run a backup.

I’ve upgraded to 5.130.3 and run sudo npm install -g ghost-cli@latest. Now, when I run ghost backup, I get the following:

ghost-mgr@ourtwocentstravel:/var/www/ghost$ ghost backup

Love open source? We’re hiring JavaScript Engineers to work on Ghost full-time.
https://careers.ghost.org


+ sudo systemctl is-active ghost_ourtwocentstravel-com
+ sudo mkdir -p /var/www/ghost/backup
? Enter your Ghost Staff access token my_email@mail.com
>> Token must follow the "{A}:{B}" format, where A is 24 hex characters and B is 64 hex characters

Not sure what that means.

My Ghost-CLI version is now 1.28.3, and my Ghost version is now 5.130.3.

Again, thanks for the guidance!

I wish the Ghost-CLI was updated when running ghost update instead of a separate process.

[edit] I see that it’s asking for my Ghost Staff access token instead of my admin email address and password. I’m looking for where to find my Ghost Staff access token.

I found my staff access token.

Go to your Ghost Blog web site, click on Settings, under General Settings, click on Staff, hover over the user you want to use to run backups (in my case, I’m the only Admin, and I’m under Owner at the top), and click on View Profile. Scroll down to the bottom and you’ll see the Staff Access token. Hover over it and click Copy.

After upgrading Ghost and the CLI, and finding and entering my Ghost Staff access token, the backup ran successfully. Thanks to those who assisted!

2 Likes

Ghost 6.0.1 is already out. It just updated some French translations.

If you are waiting for a point release that fixes some bugs or something in the 6.0 release, you might want to wait for 6.0.2 or 6.0.3, or 6.1. You can see the latest releases and what all was fixed/added here:

Thanks @ghostdan!

If 6.0.1 is out and there weren’t bug fixes in there, then it probably wasn’t too buggy, since many people have likely migrated. I’ll upgrade soon.

Thanks!

1 Like