Ghost: Ghost crashes when uploading a post image
Issue Summary
When trying to upload a post image in the editor, the POST to https://<hostname>/ghost/api/canary/admin/images/upload/ causes Ghost to crash resulting in a 502 from NGINX.
It really does a full restart, because hitting (spamming) refresh after the 502 results in the “updating our site” loading spinner and then (for a short time) the “starting up” laoding spinner.
To Reproduce
- Create a new post
- Write some text (potentially optional)
- Edit the post metadata
- Select a post image
- “Something went wrong” should appear
- (optional) spam refresh immideately after the upload fails
- “restarting” loader should appear
I expected the iimage to be uploaded. The file in question was well under the max filesize limit and I tried .jpg as well as .png.
Technical details:
- Ghost Version: 4.5.0
- Node Version: v14.17.0 (Nodesource)
- Browser/OS: Firefox 88.0.1 and Brave 1.24.84 (Chromium 90)
- Database: MySQL 15.1
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 18 (3 by maintainers)
Thought it was just the docker based container install but then went ahead with the install in ubuntu also and got the same thing, the process crashes. in dev tools i get an err_conn_refused and then it starts returning 503s after the service crashes. this isnt even going through nginx either, straight to the local ip of my box.
must be my cpu on my server. setting the config option to disable image optimization worked, which i found here https://github.com/TryGhost/Ghost/issues/13986 it does still look related to sharp but removing the node module like @zengrotrust suggested will just break it adding this to the config makes it work for me “imageOptimization”: { “resize”: false }
I’m using the official docker image, so unfortunately I don’t think this is related. In addition, the error logs contain zero useful information: https://pastebin.com/VkVLpVFW
EDIT: I’ve now made an issue in the proper location https://github.com/docker-library/ghost/issues/267#issue-988627499
Anyone have a solution? I update to 4.11 still same issue. Image upload crash site 😦
After ran
root@43844e37bd46:/var/lib/ghost/versions/5.33.8/node_modules# rm -R sharpin the container console, I can finally upload images without crashing the web server.“sharp is a high-performance image processing module for Node.js. This module assists with UGC management by offering an easy solution for reading, enhancing, and saving image files. sharp compresses images faster than most other Node.js modules, like ImageMagick, Jimp, or Squoosh, and produces high-quality results.”
@nolo14. @themaster567 you can make sure you have
libvips-devinstalled and you can runnpm i -g sharpwithout errors.I think there might be something else missing as well but you should be able to solve it by following the logged errors when installing sharp fails with something else than libvips.
I believe this was an issue with the sharp dependency which has since been resolved here:
https://github.com/lovell/sharp/commit/b69a54fc75a21e12caf80fc7d12c1693a8b4b45b
They why. Use Debian or node12-alpine
@lfuelling yeah there was another issue that came up in the context of the one I linked earlier regarding non-amd64 systems, but the initial issue was related to people experiencing restarts on Alpine Linux amd64.
The issue that I found was that sharp seemed to think it installed correctly, but something under the hood wasn’t linking correctly, resulting in segmentation faults occurring whenever Ghost attempted to handle image resizing with sharp.