# 503 error after upgrade from 2.15.0 to 2.18.1

**URL:** <https://forum.ghost.org/t/503-error-after-upgrade-from-2-15-0-to-2-18-1/6270>\
**Category:** Installation\
**Created:** [March 15, 2019, 6:32pm UTC](https://forum.ghost.org/t/503-error-after-upgrade-from-2-15-0-to-2-18-1/6270 "2019-03-15T18:32:41Z")\
**Posts on this page:** 11\
**Page:** 2

<div class="post-metadata">

**Author:** ![Peleke](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/peleke/32/2641_2.png) [@Peleke](https://forum.ghost.org/u/Peleke)\
**Post date:** [March 20, 2019, 6:45pm UTC](https://forum.ghost.org/t/503-error-after-upgrade-from-2-15-0-to-2-18-1/6270/21 "2019-03-20T18:45:15Z")

</div>

At least for me that didn’t change/fix anything. I also tried it before your fix without the init.  
Is there a way to force a new complete new migration from 2.15 to 2.18?  
What do you think about the different currentVersion entries in the database (see screenshot above)?

---

<div class="post-metadata">

**Author:** ![girish\_cloudron](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/girish_cloudron/32/2909_2.png) [@girish\_cloudron](https://forum.ghost.org/u/girish_cloudron)\
**Post date:** [March 22, 2019, 5:15am UTC](https://forum.ghost.org/t/503-error-after-upgrade-from-2-15-0-to-2-18-1/6270/22 "2019-03-22T05:15:17Z")

</div>

Same here, I haven’t seen any change in behavior after trying to upgrade with knex-migrator 3.2.6.

---

<div class="post-metadata">

**Author:** ![Kate](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kate/32/35_2.png) [@Kate](https://forum.ghost.org/u/Kate)\
**Post date:** [March 22, 2019, 5:57am UTC](https://forum.ghost.org/t/503-error-after-upgrade-from-2-15-0-to-2-18-1/6270/23 "2019-03-22T05:57:46Z")

</div>

Can somebody provide me exact steps to reproduce this?  
Thanks!

---

<div class="post-metadata">

**Author:** ![girish\_cloudron](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/girish_cloudron/32/2909_2.png) [@girish\_cloudron](https://forum.ghost.org/u/girish_cloudron)\
**Post date:** [March 22, 2019, 8:41pm UTC](https://forum.ghost.org/t/503-error-after-upgrade-from-2-15-0-to-2-18-1/6270/24 "2019-03-22T20:41:23Z")

</div>

@Kate Thanks for helping out! Just to remove Cloudron package out of the equation, I tried to reproduce this using the CLI. It seems the problem is something to do with `ghost setup migrate`.

#### Attempt 1 (ok)

- `ghost install 2.16.3`
- I can access ghost blog from browser now
- `ghost update 2.18.2` . This works, I can see `canonical_url` in the `posts` table.

#### Attempt 2 (not working)

- `npm install -g ghost-cli@1.9.9 knex-migrator@3.2.6`
- In ~/ghost, do `ghost install 2.16.3`. Ghost is now accessible via browser.
- In ~/ghost2, `ghost install 2.18.2 --no-prompt --no-stack --no-setup --no-start --dbhost notlocalhost`
  - `cp ~/ghost/config.production.json ~/ghost2/config.production.json`

- In ~/ghost2, `DEBUG=* ghost setup migrate -v`
  - The migration succeeds. The migration table has the canonical-url migration but the table itself does not have this field.
  - This result in [hastebin](https://paste.cloudron.io/uxarabudoj.rb) . In the session, I install ghost 2.18.2 and then I show the migration table and posts table before and after migrate.

Please let me know how I can help debug this further. I took snapshot of the digitalocean VPS at various points. If it helps, I can give access to them.

Edit: also, this problem specifically started from 2.17 where the 2-posts-add-canonical-url.js was introduced.

---

<div class="post-metadata">

**Author:** ![Peleke](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/peleke/32/2641_2.png) [@Peleke](https://forum.ghost.org/u/Peleke)\
**Post date:** [March 22, 2019, 9:18pm UTC](https://forum.ghost.org/t/503-error-after-upgrade-from-2-15-0-to-2-18-1/6270/25 "2019-03-22T21:18:02Z")

</div>

Another way to reproduce is to follow this tutorial with Ghost 2.15.0 for the installation and then update to 2.18.x via knex-migrator: [https://lab.uberspace.de/guide\_ghost.html](https://lab.uberspace.de/guide_ghost.html)

---

<div class="post-metadata">

**Author:** ![Peleke](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/peleke/32/2641_2.png) [@Peleke](https://forum.ghost.org/u/Peleke)\
**Post date:** [March 27, 2019, 6:22am UTC](https://forum.ghost.org/t/503-error-after-upgrade-from-2-15-0-to-2-18-1/6270/28 "2019-03-27T06:22:04Z")

</div>

The problem still exists after an update to 2.19.  
@Kate Is the --init flag recommended for an update or what is the purpose?

---

<div class="post-metadata">

**Author:** ![Kate](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kate/32/35_2.png) [@Kate](https://forum.ghost.org/u/Kate)\
**Post date:** [March 27, 2019, 1:17pm UTC](https://forum.ghost.org/t/503-error-after-upgrade-from-2-15-0-to-2-18-1/6270/29 "2019-03-27T13:17:51Z")

</div>

The flag is not recommended in general. It was designed/added for the CLI.  
The CLI doesn’t have to check whether the database needs initialisation or migration.

---

<div class="post-metadata">

**Author:** ![Peleke](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/peleke/32/2641_2.png) [@Peleke](https://forum.ghost.org/u/Peleke)\
**Post date:** [March 27, 2019, 8:20pm UTC](https://forum.ghost.org/t/503-error-after-upgrade-from-2-15-0-to-2-18-1/6270/30 "2019-03-27T20:20:41Z")

</div>

Thanks. Any other suggestions how to fix the problem?

---

<div class="post-metadata">

**Author:** ![girish\_cloudron](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/girish_cloudron/32/2909_2.png) [@girish\_cloudron](https://forum.ghost.org/u/girish_cloudron)\
**Post date:** [March 28, 2019, 1:52pm UTC](https://forum.ghost.org/t/503-error-after-upgrade-from-2-15-0-to-2-18-1/6270/31 "2019-03-28T13:52:51Z")

</div>

I was able to make it work with not calling --init. Calling `knex-migrator migrate --mgpath versions/2.18.2` works.

---

<div class="post-metadata">

**Author:** ![Peleke](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/peleke/32/2641_2.png) [@Peleke](https://forum.ghost.org/u/Peleke)\
**Post date:** [March 28, 2019, 7:22pm UTC](https://forum.ghost.org/t/503-error-after-upgrade-from-2-15-0-to-2-18-1/6270/32 "2019-03-28T19:22:38Z")

</div>

If I run that command with NODE\_ENV=production at the beginning it works but does not fix the problem.  
If I run that command exactly like you did (without NODE\_ENV=production) I get this error:

knex-migrator migrate --mgpath /home/pelek  
e7/ghost/current  
[2019-03-28 20:19:18] ERROR

NAME: DatabaseIsNotOkError  
CODE: MIGRATION\_TABLE\_IS\_MISSING  
MESSAGE: Please run knex-migrator init

level:normal

empty  
“If knex-migrator is not installed, please run "npm install -g knex  
-migrator" \nRead more here: [https://github.com/TryGhost/knex-migra](https://github.com/TryGhost/knex-migra)  
tor”  
ERROR DETAILS:  
empty

DatabaseIsNotOkError: Please run knex-migrator init

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/2X/b/ba9ce5100b8bb264586f4f572545596b2ce3f081.png) [@system](https://forum.ghost.org/u/system)\
**Post date:** [April 11, 2019, 7:22pm UTC](https://forum.ghost.org/t/503-error-after-upgrade-from-2-15-0-to-2-18-1/6270/33 "2019-04-11T19:22:41Z")

</div>

Closed on April 11, 2019, 7:22pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

[Previous page](https://forum.ghost.org/t/503-error-after-upgrade-from-2-15-0-to-2-18-1/6270.md?page=1)
