Upload images error 500

Good evening,
I migrated my site to another server (VPS)

  • Version 2.19.3
  • Environment production
  • Database mysql
  • Distro Ubuntu 18.04

I didn’t find any errors until recently.
I’m trying to upload a photo to a new article.

I get the following error:

/ghost/api/v2/admin/images/upload/:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
vendor.min-5f4c8d0cb4dabf6394e0828825b31588.js:10660 Uncaught TypeError: Cannot read property 'koenigOptions' of undefined
    at r.<anonymous> (vendor.min-5f4c8d0cb4dabf6394e0828825b31588.js:10660)
    at t.invoke (vendor.min-5f4c8d0cb4dabf6394e0828825b31588.js:4098)
    at e.t.flush (vendor.min-5f4c8d0cb4dabf6394e0828825b31588.js:4090)
    at e.t.flush (vendor.min-5f4c8d0cb4dabf6394e0828825b31588.js:4103)
    at e.r._end (vendor.min-5f4c8d0cb4dabf6394e0828825b31588.js:4165)
    at e.r.end (vendor.min-5f4c8d0cb4dabf6394e0828825b31588.js:4120)
    at e.r._run (vendor.min-5f4c8d0cb4dabf6394e0828825b31588.js:4166)
    at e.r._join (vendor.min-5f4c8d0cb4dabf6394e0828825b31588.js:4165)
    at e.r.join (vendor.min-5f4c8d0cb4dabf6394e0828825b31588.js:4131)
    at d (vendor.min-5f4c8d0cb4dabf6394e0828825b31588.js:2981)
/ghost/api/v2/admin/images/upload/:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)

If I try to enter the link https://domain.com/ghost/api/v2/admin/images/upload/:
{"errors":[{"message":"Resource not found","context":null,"type":"NotFoundError","details":null,"property":null,"help":null,"code":null,"id":"72f8d490-5af8-11e9-83fc-8bb16bab335e"}]}

What could be the problem?

Hi @giacomosilli :wave: It would be useful to have a look into the server logs of your Ghost instance (usually stored in /content/logs/ if you installed Ghost with CLI) when this error is happening for more details. Did you have any special storage configurations for your instance?

api/v2/admin/images/upload/ endpoint is not accessible via GET request, details about it’s usage can be found here:

Hi @gargol thanks for reply,

No, clean installation

From my error log:
{"name":"Log","hostname":"HOSTNAME","pid":1297,"level":50,"err":{"id":"7562dfc0-5984-11e9-83fc-8bb16bab335e","domain":"https://HOSTNAME.it","code":null,"name":"ValidationError","statusCode":422,"level":"normal","message":"Validation (isSlug) failed for slug","stack":"ValidationError: Validation (isSlug) failed for slug\n at new ValidationError (/var/www/ghost/versions/2.19.3/node_modules/ghost-ignition/lib/errors/index.js:121:23)\n at each (/var/www/ghost/versions/2.19.3/core/server/data/validation/index.js:348:35)\n at /var/www/ghost/versions/2.19.3/node_modules/lodash/lodash.js:4911:15\n at baseForOwn (/var/www/ghost/versions/2.19.3/node_modules/lodash/lodash.js:2996:24)\n at /var/www/ghost/versions/2.19.3/node_modules/lodash/lodash.js:4880:18\n at Function.forEach (/var/www/ghost/versions/2.19.3/node_modules/lodash/lodash.js:9344:14)\n at Object.validate (/var/www/ghost/versions/2.19.3/core/server/data/validation/index.js:320:7)\n at _.each (/var/www/ghost/versions/2.19.3/core/server/api/shared/validators/input/all.js:46:47)\n at /var/www/ghost/versions/2.19.3/node_modules/lodash/lodash.js:4911:15\n at baseForOwn (/var/www/ghost/versions/2.19.3/node_modules/lodash/lodash.js:2996:24)\n at /var/www/ghost/versions/2.19.3/node_modules/lodash/lodash.js:4880:18\n at Function.forEach (/var/www/ghost/versions/2.19.3/node_modules/lodash/lodash.js:9344:14)\n at validate (/var/www/ghost/versions/2.19.3/core/server/api/shared/validators/input/all.js:41:7)\n at Object.browse (/var/www/ghost/versions/2.19.3/core/server/api/shared/validators/input/all.js:105:32)\n at Object.read (/var/www/ghost/versions/2.19.3/core/server/api/shared/validators/input/all.js:115:21)\n at allShared (/var/www/ghost/versions/2.19.3/core/server/api/shared/validators/handle.js:34:58)"},"msg":"Validation (isSlug) failed for slug","time":"2019-04-07T22:28:25.150Z","v":0}

When you did this, how did you copy your content across? Did you check the permissions/ownership on the folders once you did?

  • Export json from the experiments section
  • Copy of the images folder on my desktop
  • Clean ghost installation on the new server
  • Removing demo content
  • Importing my json backup
  • Copy of the images folder on the new server
  • Upload of my theme

I have found no errors

Content folder owned by ghost with 775
Images folder owned by ghost with 775
2019 folder owned by root with 755
04 folder owned by root with 755
images.png owned by root with 644

This looks like the problem, the owner should be ghost with those permissions otherwise Ghost won’t be able to write images to the folder.

Ghost doctor does not solve the permissions problem?

A command to set permissions correctly?

For the next times, the correct procedure for importing contents after a reinstallation?

EDIT
Solved with:
sudo chown -R ghost:ghost ./content

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