# 502 errors after upgrading to Ghost 4

**URL:** <https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797>\
**Category:** Installation\
**Created:** [March 16, 2021, 8:35pm UTC](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797 "2021-03-16T20:35:53Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![bop](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bop](https://forum.ghost.org/u/bop)\
**Post date:** [March 16, 2021, 8:35pm UTC](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797/1 "2021-03-16T20:35:53Z")

</div>

After upgrading to Ghost 4.0.1 from the latest version I’m hitting 502 errors with my website. Most of the time it shows a 502 and sometimes I can see a " We’ll be right back." screen. Even sometimes it shows a skeleton site without images (only about 10% of the time).

 ![imagen](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/2X/1/1aad70c259bdce07b46f3dd512b719036ddd4c87.jpeg)

I’m using a Digital Ocean app with node v14.16.0. If I run “ghost run” the website works correcltly. My error is similar to [Upgrade to Ghost v4, but a lot of 503 error - #9 by halfrost](https://forum.ghost.org/t/upgrade-to-ghost-v4-but-a-lot-of-503-error/20762/9), but I’m seeing 502 errors.

I updated my ghost cli and ghost 3 all the way before updating. This is really bizarre, I’m not sure what’s going on.

---

<div class="post-metadata">

**Author:** ![bop](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bop](https://forum.ghost.org/u/bop)\
**Post date:** [March 16, 2021, 9:13pm UTC](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797/2 "2021-03-16T21:13:36Z")

</div>

On the meantime I started a tmux session and left `ghost run` running.

---

<div class="post-metadata">

**Author:** ![naz](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/naz/32/30666_2.png) [@naz](https://forum.ghost.org/u/naz)\
**Post date:** [March 18, 2021, 12:11am UTC](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797/3 "2021-03-18T00:11:58Z")

</div>

Hey @bop. Did you come across anything interesting pointing to the cause of the problem?

---

<div class="post-metadata">

**Author:** ![DanieleSalatti](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/danielesalatti/32/12067_2.png) [@DanieleSalatti](https://forum.ghost.org/u/DanieleSalatti)\
**Post date:** [March 18, 2021, 12:48am UTC](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797/4 "2021-03-18T00:48:53Z")

</div>

I’m having the same problem on two different instances.

I’ll try to investigate a bit, meanwhile…subscribed to this thread.

---

<div class="post-metadata">

**Author:** ![DanieleSalatti](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/danielesalatti/32/12067_2.png) [@DanieleSalatti](https://forum.ghost.org/u/DanieleSalatti)\
**Post date:** [March 18, 2021, 12:54am UTC](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797/5 "2021-03-18T00:54:38Z")

</div>

It’s stuck in a loop:

```
$ ghost log -f
+ sudo systemctl is-active ghost_danielesalatti-com
[2021-03-18 00:52:15] INFO Your site is now available on https://danielesalatti.com/
[2021-03-18 00:52:15] INFO Ctrl+C to shut down
[2021-03-18 00:52:15] INFO Ghost server started in 3.17s
[2021-03-18 00:52:16] INFO Database is in a ready state.
[2021-03-18 00:52:16] INFO Ghost database ready in 4.952s
[2021-03-18 00:52:25] INFO Ghost booted in 13.706s
[2021-03-18 00:52:26] WARN Ghost is shutting down
[2021-03-18 00:52:26] WARN Ghost has shut down
[2021-03-18 00:52:26] WARN Your site is now offline
[2021-03-18 00:52:26] WARN Ghost was running for a few seconds
[2021-03-18 00:52:26] WARN Ghost is shutting down
[2021-03-18 00:52:26] WARN Ghost has shut down
[2021-03-18 00:52:26] WARN Your site is now offline
[2021-03-18 00:52:26] WARN Ghost was running for a few seconds
[2021-03-18 00:52:32] INFO Ghost is running in production...
[2021-03-18 00:52:32] INFO Your site is now available on https://danielesalatti.com/
[2021-03-18 00:52:32] INFO Ctrl+C to shut down
[2021-03-18 00:52:32] INFO Ghost server started in 3.177s
[2021-03-18 00:52:35] INFO Database is in a ready state.
[2021-03-18 00:52:35] INFO Ghost database ready in 6.414s
[2021-03-18 00:52:45] WARN Ghost is shutting down
[2021-03-18 00:52:45] WARN Ghost has shut down
[2021-03-18 00:52:45] WARN Your site is now offline
[2021-03-18 00:52:45] WARN Ghost was running for a few seconds
[2021-03-18 00:52:45] WARN Ghost is shutting down
[2021-03-18 00:52:45] WARN Ghost has shut down
[2021-03-18 00:52:45] WARN Your site is now offline
[2021-03-18 00:52:45] WARN Ghost was running for a few seconds
[2021-03-18 00:52:51] INFO Ghost is running in production...
[2021-03-18 00:52:51] INFO Your site is now available on https://danielesalatti.com/
[2021-03-18 00:52:51] INFO Ctrl+C to shut down
[2021-03-18 00:52:51] INFO Ghost server started in 3.162s
[2021-03-18 00:52:54] INFO Database is in a ready state.
[2021-03-18 00:52:54] INFO Ghost database ready in 6.14s
[2021-03-18 00:53:04] INFO Ghost booted in 15.418s

```

The above is from running “ghost start”.

journalctl (relevant bits):

```
Mar 18 01:06:41 web-01 systemd[1]: ghost_danielesalatti-com.service: Main process exited, code=exited, status=1/FAILURE
Mar 18 01:06:41 web-01 node[190778]: [2021-03-18 01:06:41] WARN Ghost was running for a few seconds
Mar 18 01:06:41 web-01 node[190778]: [2021-03-18 01:06:41] WARN Ghost is shutting down
Mar 18 01:06:41 web-01 node[190778]: [2021-03-18 01:06:41] WARN Ghost has shut down
Mar 18 01:06:42 web-01 node[190778]: [2021-03-18 01:06:41] WARN Your site is now offline
Mar 18 01:06:42 web-01 node[190778]: [2021-03-18 01:06:42] WARN Ghost was running for a few seconds
Mar 18 01:06:42 web-01 systemd[1]: ghost_danielesalatti-com.service: Failed with result 'exit-code'.
Mar 18 01:06:42 web-01 systemd[1]: ghost_danielesalatti-com.service: Scheduled restart job, restart counter is at 27.
Mar 18 01:06:42 web-01 systemd[1]: Stopped Ghost systemd service for blog: danielesalatti-com.
Mar 18 01:06:42 web-01 systemd[1]: Started Ghost systemd service for blog: danielesalatti-com.
Mar 18 01:06:44 web-01 node[190815]: - Inspecting operating system
Mar 18 01:06:48 web-01 node[190871]: [2021-03-18 01:06:48] INFO Ghost is running in production...
Mar 18 01:06:48 web-01 node[190871]: [2021-03-18 01:06:48] INFO Your site is now available on https://danielesalatti.com/
Mar 18 01:06:48 web-01 node[190871]: [2021-03-18 01:06:48] INFO Ctrl+C to shut down
Mar 18 01:06:48 web-01 node[190871]: [2021-03-18 01:06:48] INFO Ghost server started in 3.298s
Mar 18 01:06:50 web-01 node[190871]: [2021-03-18 01:06:50] INFO Database is in a ready state.
Mar 18 01:06:50 web-01 node[190871]: [2021-03-18 01:06:50] INFO Ghost database ready in 5.291s
Mar 18 01:06:59 web-01 node[190871]: [2021-03-18 01:06:59] INFO Ghost booted in 13.9s
Mar 18 01:07:00 web-01 node[190815]: /home/ubuntu/.nvm/versions/node/v12.18.3/lib/node_modules/ghost-cli/lib/process-manager.js:46
Mar 18 01:07:00 web-01 node[190815]: throw error;
Mar 18 01:07:00 web-01 node[190815]: ^
Mar 18 01:07:00 web-01 node[190871]: [2021-03-18 01:07:00] WARN Ghost is shutting down
Mar 18 01:07:00 web-01 node[190815]: { message: undefined }
Mar 18 01:07:00 web-01 node[190871]: [2021-03-18 01:07:00] WARN Ghost has shut down
Mar 18 01:07:00 web-01 systemd[1]: ghost_danielesalatti-com.service: Main process exited, code=exited, status=1/FAILURE

```

Interesting because that is not the version of nodejs that I have set as default with nvm. Switching to that one and trying to restart causes ghost to give an error (was not installed with this version, run ghost update v4.0.1 --force).

Uninstalled ghost-cli, switched back to LTS (node v14) and trying again.

(I’m editing/updating this post as I go)

---

<div class="post-metadata">

**Author:** ![halfrost](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/halfrost/32/8986_2.png) [@halfrost](https://forum.ghost.org/u/halfrost)\
**Post date:** [March 18, 2021, 1:26am UTC](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797/7 "2021-03-18T01:26:30Z")

</div>

@DanieleSalatti my error log is the same with you.

---

<div class="post-metadata">

**Author:** ![DanieleSalatti](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/danielesalatti/32/12067_2.png) [@DanieleSalatti](https://forum.ghost.org/u/DanieleSalatti)\
**Post date:** [March 18, 2021, 1:33am UTC](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797/8 "2021-03-18T01:33:44Z")

</div>

Looks like /etc/systemd/system/ghost\_danielesalatti-com.service points to the wrong node version. Manually fixed that, trying to restart.

Edit: did not work

---

<div class="post-metadata">

**Author:** ![DanieleSalatti](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/danielesalatti/32/12067_2.png) [@DanieleSalatti](https://forum.ghost.org/u/DanieleSalatti)\
**Post date:** [March 18, 2021, 3:17am UTC](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797/9 "2021-03-18T03:17:53Z")

</div>

Solved!

Had to change the file in `/etc/systemd/system/ghost_danielesalatti-com.service` and swap the node version from:

`/home/ubuntu/.nvm/versions/node/v12.8.3/bin/node /home/ubuntu/.nvm/versions/node/v12.8.3/bin/ghost run`

to:

`/home/ubuntu/.nvm/versions/node/v14.15.4/bin/node /home/ubuntu/.nvm/versions/node/v14.15.4/bin/ghost run`

And then run:

`systemctl daemon-reload`

After that `ghost restart` and everything works again.

---

<div class="post-metadata">

**Author:** ![halfrost](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/halfrost/32/8986_2.png) [@halfrost](https://forum.ghost.org/u/halfrost)\
**Post date:** [March 18, 2021, 4:16am UTC](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797/10 "2021-03-18T04:16:56Z")

</div>

@DanieleSalatti I install node v14.15.4, then run `ghost restart`, but some error occur:

```auto
One or more errors occurred.

1) Checking system Node.js version

Message: The version of Node.js you are using is not supported.
Supported: ^8.16.0 || ^10.13.0 || ^12.10.0
Installed: 14.15.4
See https://ghost.org/faq/node-versions/ for more information

2) Checking binary dependencies

Message: The installed node version has changed since Ghost was installed.
Help: Run ghost update 4.0.1 --force to re-install binary dependencies.

Debug Information:
    OS: CentOS Linux, v7
    Node Version: v14.15.4
    Ghost Version: 4.0.1
    Ghost-CLI Version: 1.13.1
    Environment: production
    Command: 'ghost doctor'

Try running ghost doctor to check your system for known issues.

You can always refer to https://ghost.org/docs/api/ghost-cli/ for troubleshooting.

```

It seems doesn’t support v14.15.4. How you swap the node version?

---

<div class="post-metadata">

**Author:** ![naz](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/naz/32/30666_2.png) [@naz](https://forum.ghost.org/u/naz)\
**Post date:** [March 18, 2021, 6:09am UTC](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797/11 "2021-03-18T06:09:54Z")

</div>

Nice one @DanieleSalatti !

---

<div class="post-metadata">

**Author:** ![halfrost](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/halfrost/32/8986_2.png) [@halfrost](https://forum.ghost.org/u/halfrost)\
**Post date:** [March 18, 2021, 6:39am UTC](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797/12 "2021-03-18T06:39:02Z")

</div>

@DanieleSalatti How to swap node version? just swap the file? I copy the node file from v12.18.2 to v14.15.4. when I run `ghost run`, error shows up:

```auto
internal/modules/cjs/loader.js:969
  throw err;
  ^

Error: Cannot find module '../lib/bootstrap'
Require stack:
- /root/.nvm/versions/node/v14.15.4/bin/ghost
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/root/.nvm/versions/node/v14.15.4/bin/ghost:15:19)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: ['/root/.nvm/versions/node/v14.15.4/bin/ghost']
}

```

---

<div class="post-metadata">

**Author:** ![Hannah](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/hannah/32/22_2.png) [@Hannah](https://forum.ghost.org/u/Hannah)\
**Post date:** [March 18, 2021, 8:47am UTC](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797/13 "2021-03-18T08:47:52Z")

</div>

Reading this thread and [Upgrade to Ghost v4, but a lot of 503 error](https://forum.ghost.org/t/upgrade-to-ghost-v4-but-a-lot-of-503-error/20762)

From what I can tell, everyone affected is on Node v14, and the problem is not with Node v14 itself but rather with how Node has been updated meaning Ghost is getting two different node versions.

We know the CLI is not good at catching and making these issues visible right now and it’s something we’re looking into to try to help.

If you are using nvm to manage Node, please make sure you’ve read this: [Using nvm with local and production Ghost installs](https://ghost.org/docs/faq/using-nvm/)

If you are updating Node, it’s a really good idea to do this separately to updating Ghost to 4.0.

My recommendation for anyone updating is to do the following:

- `ghost version` to get your current Ghost version
- update node
- run `ghost update [ghost version] --force` to do a reinstall of the current Ghost version
- check everything is ok
- now run `ghost update` to update Ghost itself

* * *

If you’ve already done the update and are running into problems, it will be easier to help if everyone starts their own threads.

Please share the normal debug info and also:

- did you just update node? If so how?
- output from `which node`
- output from `node --version`
- your systemd file
- ⚠ Important, take care: The output from running node --version with the full path from Exec Start in systemd, so if your ExecStart says `ExecStart=/usr/bin/node /usr/bin/ghost run` then share the output from running /usr/bin/node --version`

This should be a good start.

* * *

This thread was started by @bop and so let’s wait for more info from them.

Looks like @DanieleSalatti fixed their nvm-related problem and shared the solution, really nice thank you. @halfrost I will try to help in your thread here: [Upgrade to Ghost v4, but a lot of 503 error - #27 by naz](https://forum.ghost.org/t/upgrade-to-ghost-v4-but-a-lot-of-503-error/20762/27)

---

<div class="post-metadata">

**Author:** ![DanieleSalatti](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/danielesalatti/32/12067_2.png) [@DanieleSalatti](https://forum.ghost.org/u/DanieleSalatti)\
**Post date:** [March 18, 2021, 2:27pm UTC](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797/14 "2021-03-18T14:27:13Z")

</div>

Yep, I updated this thread instead of creating a new one with the assumption that the problem might have been the same. Hopefully it helps @bop and others.

@halfrost sorry, it was late so I ended up going to bed 😛 I see your issue was solved by following Hannah’s instructions in the other thread though 🙂

---

<div class="post-metadata">

**Author:** ![halfrost](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/halfrost/32/8986_2.png) [@halfrost](https://forum.ghost.org/u/halfrost)\
**Post date:** [March 18, 2021, 3:16pm UTC](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797/15 "2021-03-18T15:16:30Z")

</div>

@DanieleSalatti Yes, my website is working now. ([https://halfrost.com/](https://halfrost.com/))

It doesn’t matter, we all have jet lag, and each of us has our own work and life. I don’t mind if the reply is late. I wish you a good dream. Good night~ 🌙 Thank you again~

---

<div class="post-metadata">

**Author:** ![bop](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bop](https://forum.ghost.org/u/bop)\
**Post date:** [March 18, 2021, 7:45pm UTC](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797/16 "2021-03-18T19:45:25Z")

</div>

> [@Hannah](#):
>
> - did you just update node? If so how?:
> - output from `which node`
> - output from `node --version`
> - your systemd file
> - ⚠ Important, take care: The output from running node --version with the full path from Exec Start in systemd, so if your ExecStart says `ExecStart=/usr/bin/node /usr/bin/ghost run` then share the output from running /usr/bin/node --version`

Hannah, I appreciate a lot your thorough feedback and response.

- I updated node through the nodesource setup listed on the [main DigitalOcean tutorial](https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04#option-2-%E2%80%94-installing-nodejs-with-apt-using-a-nodesource-ppa). I ran the same commands listed on the tutorial. I updated node before updating Ghost to the latest version.

- This is the output of `which node`:

```auto
$ which node
/usr/bin/node

```

- This is the output of `node --version`:

```auto
$ node --version
v14.16.0

```

- This is my systemd file

```auto
[Unit]
Description=Ghost systemd service for blog
Documentation=https://docs.ghost.org

[Service]
Type=simple
WorkingDirectory=/var/www/ghost
User=999
Environment="NODE_ENV=production"
ExecStart=/usr/bin/node /usr/local/bin/ghost run
Restart=always

[Install]
WantedBy=multi-user.target

```

When I run `ghost doctor` everything is green.

If I ran `ghost start` and then `ghost log -f` this is what I see:

```auto
[2021-03-18 19:36:51] INFO Ghost is running in production...
[2021-03-18 19:36:51] INFO Your site is now available on ...
[2021-03-18 19:36:51] INFO Ctrl+C to shut down
[2021-03-18 19:36:51] INFO Ghost server started in 1.323s
[2021-03-18 19:36:52] INFO Database is in a ready state.
[2021-03-18 19:36:52] INFO Ghost database ready in 1.875s
[2021-03-18 19:36:54] INFO Ghost booted in 4.572s
[2021-03-18 19:36:55] WARN

NAME: HelperWarning
CODE: SLOW_GET_HELPER
MESSAGE: {{#get}} helper took 234ms to complete

level: normal

ERROR DETAILS:
    {"api":"v4.postsPublic.browse","apiOptions":{"filter":"tag:hash-personal-work"},"returnedRows":1}

[2021-03-18 19:36:55] WARN

NAME: HelperWarning
CODE: SLOW_GET_HELPER
MESSAGE: {{#get}} helper took 239ms to complete

level: normal

ERROR DETAILS:
    {"api":"v4.postsPublic.browse","apiOptions":{"filter":"tag:hash-client-work"},"returnedRows":4}

[2021-03-18 19:36:55] ERROR "GET /" 503 278ms

NAME: MaintenanceError
MESSAGE: Site is starting up, please wait a moment then retry.

level: normal

MaintenanceError: Site is starting up, please wait a moment then retry.
    at new MaintenanceError (/var/www/ghost/versions/4.0.1/node_modules/@tryghost/errors/node_modules/ghost-ignition/lib/errors/index.js:162:23)
    at maintenance (/var/www/ghost/versions/4.0.1/core/server/web/shared/middlewares/maintenance.js:14:21)
    at Layer.handle [as handle_request] (/var/www/ghost/versions/4.0.1/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/var/www/ghost/versions/4.0.1/node_modules/express/lib/router/index.js:317:13)
    at /var/www/ghost/versions/4.0.1/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/var/www/ghost/versions/4.0.1/node_modules/express/lib/router/index.js:335:12)
    at next (/var/www/ghost/versions/4.0.1/node_modules/express/lib/router/index.js:275:10)
    at servePublicFileMiddleware (/var/www/ghost/versions/4.0.1/core/server/web/site/middleware/serve-public-file.js:75:20)
    at Layer.handle [as handle_request] (/var/www/ghost/versions/4.0.1/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/var/www/ghost/versions/4.0.1/node_modules/express/lib/router/index.js:317:13)
    at /var/www/ghost/versions/4.0.1/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/var/www/ghost/versions/4.0.1/node_modules/express/lib/router/index.js:335:12)
    at next (/var/www/ghost/versions/4.0.1/node_modules/express/lib/router/index.js:275:10)
    at SendStream.error (/var/www/ghost/versions/4.0.1/node_modules/serve-static/index.js:121:7)
    at SendStream.emit (events.js:315:20)
    at SendStream.EventEmitter.emit (domain.js:467:12)

[2021-03-18 19:36:55] INFO "GET /assets/built/main.css?v=7b7730315d" 200 11ms
[2021-03-18 19:36:55] INFO "GET /assets/built/bundle.js?v=7b7730315d" 200 14ms
[2021-03-18 19:36:55] WARN Ghost is shutting down
[2021-03-18 19:36:55] WARN Ghost has shut down
[2021-03-18 19:36:55] WARN Your site is now offline
[2021-03-18 19:36:55] WARN Ghost was running for a few seconds
[2021-03-18 19:36:55] INFO "GET /assets/built/main.css?v=7b7730315d" 200 11ms
[2021-03-18 19:36:55] INFO "GET /assets/built/bundle.js?v=7b7730315d" 200 14ms
[2021-03-18 19:36:55] WARN Ghost is shutting down
[2021-03-18 19:36:55] WARN Ghost has shut down
[2021-03-18 19:36:55] WARN Your site is now offline
[2021-03-18 19:36:55] WARN Ghost was running for a few seconds
[2021-03-18 19:36:58] INFO Ghost is running in production...
[2021-03-18 19:36:58] INFO Your site is now available on ...
[2021-03-18 19:36:58] INFO Ctrl+C to shut down
[2021-03-18 19:36:58] INFO Ghost server started in 1.525s
[2021-03-18 19:36:59] INFO Database is in a ready state.
[2021-03-18 19:36:59] INFO Ghost database ready in 2.034s
[2021-03-18 19:37:01] INFO Ghost booted in 4.888s
[2021-03-18 19:37:02] WARN Ghost is shutting down
[2021-03-18 19:37:02] WARN Ghost has shut down
[2021-03-18 19:37:02] WARN Your site is now offline
[2021-03-18 19:37:02] WARN Ghost was running for a few seconds
[2021-03-18 19:37:05] INFO Ghost is running in production...
[2021-03-18 19:37:05] INFO Your site is now available on -...
[2021-03-18 19:37:05] INFO Ctrl+C to shut down
[2021-03-18 19:37:05] INFO Ghost server started in 1.087s
[2021-03-18 19:37:05] INFO Database is in a ready state.
[2021-03-18 19:37:05] INFO Ghost database ready in 1.599s
[2021-03-18 19:37:08] INFO Ghost booted in 4.231s
[2021-03-18 19:37:09] WARN Ghost is shutting down
[2021-03-18 19:37:09] WARN Ghost has shut down
[2021-03-18 19:37:09] WARN Your site is now offline
[2021-03-18 19:37:09] WARN Ghost was running for a few seconds
[2021-03-18 19:37:11] INFO Ghost is running in production...
[2021-03-18 19:37:11] INFO Your site is now available on ...
[2021-03-18 19:37:11] INFO Ctrl+C to shut down
[2021-03-18 19:37:11] INFO Ghost server started in 1.288s
[2021-03-18 19:37:12] INFO Database is in a ready state.
[2021-03-18 19:37:12] INFO Ghost database ready in 1.676s
[2021-03-18 19:37:14] INFO Ghost booted in 4.212s
[2021-03-18 19:37:15] WARN Ghost is shutting down
[2021-03-18 19:37:15] WARN Ghost has shut down
[2021-03-18 19:37:15] WARN Your site is now offline
[2021-03-18 19:37:15] WARN Ghost was running for a few seconds
[2021-03-18 19:37:17] INFO Ghost is running in production...
[2021-03-18 19:37:17] INFO Your site is now available on ...

```

It basically seems to go endlessly on a loop of reboots. If I reload the page fast enough sometimes I can catch this error between 502 and “We’re back” messages:

```auto
[2021-03-18 19:39:42] INFO Ghost booted in 3.845s
[2021-03-18 19:39:43] WARN Ghost is shutting down
[2021-03-18 19:39:43] ERROR

NAME: InternalServerError
CODE: IMAGE_SIZE_URL
MESSAGE: Unknown Request error.

level: critical

"https://my_webite.foo/favicon.ico"
InternalServerError: Unknown Request error.
    at new InternalServerError (/var/www/ghost/versions/4.0.1/node_modules/@tryghost/errors/node_modules/ghost-ignition/lib/errors/index.js:90:23)
    at /var/www/ghost/versions/4.0.1/core/server/lib/image/image-size.js:179:35
    at tryCatcher (/var/www/ghost/versions/4.0.1/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/var/www/ghost/versions/4.0.1/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/var/www/ghost/versions/4.0.1/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/var/www/ghost/versions/4.0.1/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/var/www/ghost/versions/4.0.1/node_modules/bluebird/js/release/promise.js:725:18)
    at _drainQueueStep (/var/www/ghost/versions/4.0.1/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/var/www/ghost/versions/4.0.1/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/var/www/ghost/versions/4.0.1/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/var/www/ghost/versions/4.0.1/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (internal/timers.js:461:21)

HTTPError: Response code 502 (Bad Gateway)
    at EventEmitter.<anonymous> (/var/www/ghost/versions/4.0.1/node_modules/got/source/as-promise.js:74:19)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

[2021-03-18 19:39:43] INFO "GET /" 200 396ms
[2021-03-18 19:39:43] WARN Ghost has shut down
[2021-03-18 19:39:43] WARN Your site is now offline
[2021-03-18 19:39:43] WARN Ghost was running for a few seconds
[2021-03-18 19:39:45] INFO Ghost is running in production...

```

This only happens when I due `ghost start`, when I do `ghost run` and log the responses everything seems normal:

```auto
2021-03-18 19:43:50] INFO Ghost server started in 1.071s
[2021-03-18 19:43:50] INFO Database is in a ready state.
[2021-03-18 19:43:50] INFO Ghost database ready in 1.476s
[2021-03-18 19:43:53] INFO Ghost booted in 4.098s
[2021-03-18 19:44:39] INFO "GET /favicon.ico" 200 20ms
[2021-03-18 19:44:39] INFO "GET /" 200 488ms
[2021-03-18 19:44:39] INFO "GET /assets/built/main.css?v=dfcd71ef69" 200 33ms
[2021-03-18 19:44:39] INFO "GET /assets/built/bundle.js?v=dfcd71ef69" 200 36ms
[2021-03-18 19:44:39] INFO "GET /content/images/2021/03/01-copy.jpg" 304 3ms
[2021-03-18 19:44:39] INFO "GET /content/images/2021/03/01-4.jpg" 304 6ms
[2021-03-18 19:44:39] INFO "GET /members/api/site/" 200 3ms
[2021-03-18 19:44:39] INFO "GET /members/api/member/" 401 1ms

```

Thanks for your help, again, I really appreciate it.

---

<div class="post-metadata">

**Author:** ![Hannah](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/hannah/32/22_2.png) [@Hannah](https://forum.ghost.org/u/Hannah)\
**Post date:** [March 18, 2021, 9:12pm UTC](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797/17 "2021-03-18T21:12:10Z")

</div>

Ok so it doesn’t look like you have the same duplicate node version issue as other people have seen, or if you do it’s a lot harder to find!

Would you be able to downgrade back to node 12 (assuming that’s what you were on before) following these (updated) instructions: [Supported node versions for self-hosted installs of Ghost](https://ghost.org/docs/faq/node-versions/#upgrade-nodejs)?

Let’s see if that at least stabilises things and then we can figure out next steps from there.

---

<div class="post-metadata">

**Author:** ![bop](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bop](https://forum.ghost.org/u/bop)\
**Post date:** [March 19, 2021, 8:52am UTC](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797/18 "2021-03-19T08:52:48Z")

</div>

Hi Hannah. Indeed, it doesn’t look like the other issue with nvm. I tried downgrading to node 12 using the instructions and no luck, ghost behaved in the same way.

I am tempted to try the steps listed here ([Possible solution of error (502/503) when upgrading to Ghost v4](https://forum.ghost.org/t/possible-solution-of-error-502-503-when-upgrading-to-ghost-v4/20943)). Maybe a wider reinstall could fix the problem?

---

<div class="post-metadata">

**Author:** ![bop](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bop](https://forum.ghost.org/u/bop)\
**Post date:** [March 19, 2021, 10:39pm UTC](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797/19 "2021-03-19T22:39:56Z")

</div>

Hello Hannah, I went through the reinstall of `ghost-cli` suggested in the thread above but unfortunately it didn’t work. I still get 502 errors and constant reboots when doing `ghost start`. `ghost run` continues to work without issue.

---

<div class="post-metadata">

**Author:** ![bop](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bop](https://forum.ghost.org/u/bop)\
**Post date:** [March 19, 2021, 11:00pm UTC](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797/21 "2021-03-19T23:00:26Z")

</div>

This is the output of `sudo systemcl status ghost_service` :

```auto
● ghost.service - Ghost systemd service for blog: .
   Loaded: loaded (/var/www/ghost/system/files/ghost.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2021-03-19 22:44:25 UTC; 4min 23s ago
     Docs: https://docs.ghost.org
  Process: 14582 ExecStart=/usr/bin/node /usr/local/bin/ghost run (code=exited, status=1/FAILURE)
 Main PID: 14582 (code=exited, status=1/FAILURE)

Mar 19 22:44:24 my_machine node[14582]: [2021-03-19 22:44:24] WARN Ghost has shut down
Mar 19 22:44:24 my_machine node[14582]: [2021-03-19 22:44:24] WARN Your site is now offline
Mar 19 22:44:24 my_machine node[14582]: [2021-03-19 22:44:24] WARN Ghost was running for a few seconds
Mar 19 22:44:25 my_machine node[14582]: /usr/local/lib/node_modules/ghost-cli/lib/process-manager.js:52
Mar 19 22:44:25 my_machine node[14582]: throw error;
Mar 19 22:44:25 my_machine node[14582]: ^
Mar 19 22:44:25 my_machine node[14582]: { message: undefined }
Mar 19 22:44:25 my_machine systemd[1]: ghost.service: Main process exited, code=exited, status=1/FAILURE
Mar 19 22:44:25 my_machine systemd[1]: ghost.service: Failed with result 'exit-code'.
Mar 19 22:44:25 my_machine systemd[1]: Stopped Ghost systemd service for blog: .

```

I found [this similar issue](https://github.com/TryGhost/Ghost-CLI/issues/361) on GitHub, but I don’t even have nvm installed.

---

<div class="post-metadata">

**Author:** ![bop](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bop](https://forum.ghost.org/u/bop)\
**Post date:** [March 19, 2021, 11:21pm UTC](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797/22 "2021-03-19T23:21:17Z")

</div>

I have discovered that I had a weird alias on my bash profile with the ghost command. I removed it:

```auto
alias ghost=/usr/bin/ghost

```

I also got rid of the `nodejs` command ([installation - NPM wont work because of my wrong node version - Ask Ubuntu](https://askubuntu.com/questions/292430/npm-wont-work-because-of-my-wrong-node-version?rq=1)) and made sure there wasn’t any nvm cruft on my server ([Using nvm with local and production Ghost installs](https://ghost.org/docs/faq/using-nvm/)).

After doing all of this now I’m getting a different output:

```auto
ghost-mgr@my_computer:/var/www/ghost$ sudo journalctl -u ghost-art -n 50
-- Logs begin at Mon 2020-08-31 19:23:31 UTC, end at Fri 2021-03-19 23:14:43 UTC. --
Mar 19 23:14:28 my_computer node[1925]: [2021-03-19 23:14:28] INFO Ghost server started in 1.305s
Mar 19 23:14:28 my_computer node[1925]: [2021-03-19 23:14:28] INFO Database is in a ready state.
Mar 19 23:14:28 my_computer node[1925]: [2021-03-19 23:14:28] INFO Ghost database ready in 1.665s
Mar 19 23:14:30 my_computer node[1925]: [2021-03-19 23:14:30] INFO Ghost booted in 3.917s
Mar 19 23:14:30 my_computer node[1925]: [2021-03-19 23:14:30] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED.
Mar 19 23:14:30 my_computer node[1925]: [2021-03-19 23:14:30] WARN Tries: 0
Mar 19 23:14:30 my_computer node[1925]: [2021-03-19 23:14:30] WARN Retrying...
Mar 19 23:14:31 my_computer node[1925]: [2021-03-19 23:14:31] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED.
Mar 19 23:14:31 my_computer node[1925]: [2021-03-19 23:14:31] WARN Tries: 1
Mar 19 23:14:31 my_computer node[1925]: [2021-03-19 23:14:31] WARN Retrying...
Mar 19 23:14:31 my_computer node[1925]: [2021-03-19 23:14:31] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED.
Mar 19 23:14:31 my_computer node[1925]: [2021-03-19 23:14:31] WARN Tries: 2
Mar 19 23:14:31 my_computer node[1925]: [2021-03-19 23:14:31] WARN Retrying...
Mar 19 23:14:31 my_computer node[1925]: [2021-03-19 23:14:31] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED.
Mar 19 23:14:31 my_computer node[1925]: /usr/local/lib/node_modules/ghost-cli/lib/process-manager.js:52
Mar 19 23:14:31 my_computer node[1925]: throw error;
Mar 19 23:14:31 my_computer node[1925]: ^
Mar 19 23:14:31 my_computer node[1925]: { message: undefined }
Mar 19 23:14:31 my_computer systemd[1]: ghost-art.service: Main process exited, code=exited, status=1/FAILURE
Mar 19 23:14:31 my_computer node[1925]: [2021-03-19 23:14:31] WARN Ghost is shutting down
Mar 19 23:14:31 my_computer node[1925]: [2021-03-19 23:14:31] WARN Ghost has shut down
Mar 19 23:14:31 my_computer node[1925]: [2021-03-19 23:14:31] WARN Your site is now offline

```

This seems like [this error](https://github.com/TryGhost/Ghost-CLI/issues/1017) but my port is the right one. I tried removing the boostrap socket section on my `config.production.json` but it didn’t do anything and the key went back after running `ghost start`.

Doing `ghost run` still works fine.

[Next page](https://forum.ghost.org/t/502-errors-after-upgrading-to-ghost-4/20797.md?page=2)
