-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
502 on image upload, but works fine with ghost run
#11129
Comments
Update: |
As you got it working again by downgrading I'm not sure if nginx is the problem. On my droplet running CentOS I had to change the max size of any file being uploaded in the base config of nginx located in
|
Hey @ekerstein 👋 We ask that you please do not use GitHub for help or support 😄. We use GitHub solely for bug-tracking and on-going feature development. Many questions can be answered by reviewing our documentation. If you can't find an answer then our forum is a great place to get community support, plus it helps create a central location for searching problems/solutions. FYI: Many projects have their own support guidelines and GitHub will highlight them for you as it did here, or the project owners will use issue templates to point you in the right direction. Reading the guidelines or issue templates before opening issues can save you and project maintainers valuable time. |
@andreborud What do you recommend changing the client_max_body_size to? |
Up to you, depends on how large files you plan to upload. I set it to 50 so I don't need to think about it too much. |
Dunno if it was the same problem. But in my case, the issue was that some images were stored in For example: I had to copy Edit: Adding this comment because editing |
@ekerstein Did you manage to get it working? I have run in to the same issue now. I haven't tried to upload an image for a while, tried last night and I get a 502 error. |
In ghost I get "Something went wrong :(" and when inspecting I see this error: But going in to the error logs of ghost there is no 502 errors logged, the only persistent error is the following:
The NGINX error logs reports this:
I have also tried to temporarily disable SELinux, no difference. |
Actually no. Yesterday I was publishing an article and had to |
Stopping ghost and then start it with run and then start works for me as well. |
@andreborud Honestly, I haven't tried against since rolling back to 2.30.2. So I just tested it again now:
I came across this issue related to the config server.port being 2369 while nginx was on 2368. I realized I had the same issue! So I did
I rolled back to 2.30.2 again and everything is working. So now I'm not sure if the issue is related to the port 2368 that I changed or something else. |
FYI - v.2.34.0 fixed my 500 error issue. However, now my 502 error on image upload (not occuring during |
I have a feeling this is to do with sharp. I think maybe it doesn't always install properly, and when it doesn't, we're not falling back gracefully like we should. In the case of a "recommended stack" setup, it should always install. @ekerstein can you look through your versions/xx/node_modules folders and see if sharp is in some or all of them? We are looking into this, but it's slow work & very hard to track down because we haven't reproduced it yet. Also can you run |
Updated to 2.34.0 this morning and the problem persists. And sharp is installed on this and previous versions. |
What does |
Well I'm running ghost on CentOS so the doctor isn't to excited about that. You can see the output below.
However, I have been running ghost for a long time on CentOS without this problem, it popped up recently, not entirely certain what version introduced the bug. And stopping ghost and running it with ghost run instead make the image upload work again. Is there any other information I can provide for you guys to make things easier? |
@ErisDS Checked some of my versions folders. The version I kept rolling back to that worked (2.30.2) has sharp version 0.23.0. The latest version of Ghost has 0.23.1. Not sure if that means anything.. but I'm happy to provide more details if I can help. |
I've got the same problem and image uploading works only with "ghost run". When I try use "ghost start" i've got error 502. |
This problem still happens in Ghost 3.0.0 |
I was really hoping this would be fixed in such a major version update. I am facing the same problem Ghost CLI Version is 1.12.0 Hosted on a Digital Ocean droplet |
I tried going into the |
Maybe discovered something? I decided to just add logging extensively throughout the image processing files. In lib/image/manipulator.js I added logging to everything. Then I uploaded a file to see the normal process vs broken process. Based on the logging, this is my understanding of what happens when you upload a file. This is using
So then I tried it in production with
Every time it fails, "log 1" is logged, and then it never makes it to "log 2". It restarts immediately after "log 1" like this:
I assume it was failing on
Seeing as the issue is sharp, I tried reinstalling Ghost, downgrading sharp to 0.23.0, and 0.22.1, but no luck. |
Getting the same error on Ghost v3.0.1 and Node v10.13.0. From the above conversation it looks like installing
but I'm unsure if that addresses the issue we're seeing here. Happy to help debug in any way. |
Oh my god... I've been struggling with the 502 error with many recent 3.x updates and had to always roll back. This was my exact problem too. Something is messed up with the 3.x upgrades regarding nginx port setup. |
Update: I created a new DO droplet (for unrelated reasons, moving my site to a subdomain) with: I ran into an issue where my permissions on my content folder was incorrect, but after I fixed that, I can upload files just fine, without the libvips/sharp package version fix. 🤷♀ If creating a new instance is doable for you, it seems to be fixed now. |
I've tried every fix here, including downgrading libvips version used by sharp and installing a brand new ghost instance and copying over content and although it solves the 502 error on upload, responsive images are no longer generated. Respective folders and images are not created inside content/images/size/. Has anyone managed to fix this part of the issue? |
This is a major issue! I'm shocked that it has still not been fixed given the number of Ghost releases. Is this bug not considered high priority? |
@darrenmhill regardless of the importance of this issue, it's quite difficult to fix as we're not able to create a RCA with the updated version of libvps. In the meantime, many people have mentioned that migrating to a new droplet or downgrading libvps and upgrading sharp in your installation is a valid workaround. |
I got the same image upload problem described above when I installed a fresh copy of Ghost today on CentOS 7 from the zip file: https://ghost.org/zip/ghost-latest.zip The relevant versions were: Ghost-CLI version: 1.13.1 I had been running Ghost via systemctl so, after reading the above posts, I tried running it via "ghost run". It started ok but when I tried to upload an image I got this error:
The advice was to:
I noticed my CentOS 7 distribution is running zlib 1.2.7.
Then I started Ghost via systemctl and the image upload worked fine. Just thought I would share that in case it is of any help in resolving this. |
Edit: It looks like it did work. However, I had to specify sharp v0.24, e.g.
|
This thread has been incredibly helpful thanks all who have contributed to the investigation of this! My set up too is a pre-installed Ghost set up on a DigitalOcean box. After reading through all this I tried the installation of a new ghost instance which ended up working. I ran |
Hi all! Just to let you know that Ghost 3.9.0 has shipped with sharp 0.24.1. You might need to update with |
@daniellockyer Thank you! I had this 502 issue and avoided upgrading Ghost in case it breaks temporary solution that’s described here. I upgraded Ghost (it didn’t require |
Excellent news! Confirmed working fine for me now. I'd missed this being closed and didn't see anything in the main release notes, but very happy my problems are now solved. Great job all. |
We weren't 100% sure the issue was fixed - it's been impossible to reproduce, but have updated the release notes now. |
It's fixed for me and I and my team massively appreciate it! Thank you :) |
I'm getting this issue using the |
I confirm this was fixed as well. Thanks! |
I have just upgraded to ghost version 4 and having this same issue. When I downgrade to 3 I can confirm its working. I am running ghost in a docker container. I am suspecting, it could be a regression on ghost 4. |
I have some problems with ghost upload images after upgrade a couples of days ago. Ghost version: 4.4.0 Now my blog works perfectly but I can’t upload images anyway in may posts… ghost error log show: ERROR “GET /ghost/api/canary/admin/notifications/” 500 223ms My nginx error log show: 2021/05/06 14:17:52 [error] 30072#30072: *4997 connect() failed (111: Connection refused) while connecting to upstream, client: X, server: X, request: "POST /ghost/api/canary/admin/images/upload/ $ 2021/05/06 14:35:34 [error] 30072#30072: *5086 upstream prematurely closed connection while reading response header from upstream, client: X, server: X, request: "POST /ghost/api/canary/admin/imag$ 2021/05/06 14:35:38 [error] 30072#30072: *5086 connect() failed (111: Connection refused) while connecting to upstream, client:X, server: X, request: "GET /ghost/api/canary/admin/posts/?limit=30&$ I get working upload images if I disable Image optimization in config.production.json adding “imageOptimization”: { Disabled image optimization works for post image but not for images in post body which follow crashing site 😦 trying with removed the /my/path/versions/4.4.0/node_modules/sharp directory then reinstalled sharp via: npm install sharp Not working… Uninstall ghost, delete directory, create new directory and install ghost from 0 and after that import /content/images… same problem 😱 |
Try to reinstall using Node 12. |
In a fresh install @pascalandy or only with ghost update --force after node 12 installation??? |
I can't help on that as I run things in Docker. But I'm sure this will help: https://forum.ghost.org/t/minimum-node-js-versions-changing-to-12-22-1-14-16-1-node-v10-is-eol/22527 |
Thanks so much @pascalandy but unfortunately downgrade to node 12 not working. Still same issue, upload photo crash and restart site :( |
Hello, I have the same problem And in nginx error log : [error] 16768#16768: *61 upstream prematurely closed connection while reading response header from upstream, client: 192.168.1.254, server: www.ecuri.es, request: "POST /ghost/api/canary/admin/images/upload/ HTTP/2.0", upstream: "http://127.0.0.1:2368/ghost/api/canary/admin/images/upload/", host: "www.ecuri.es", referrer: "https://www.ecuri.es/ghost/" I rollbacked to v4.3.3 with Node 12.20.1 :( |
Rolling back to 4.3.3 Alpine container fixed it for me. Must be something to do with the latest version |
Anyone have a solution? I update to 4.11 still same issue. Image upload crash site :( |
Ghost 5.4.1 Was receiving the same 502 Error. Resolved it in the following way. cd var/www/blog/versions/5.4.1/node_modules Did a ghost start and problem is resolved re: Image uploads. I will edit this post if I encounter any additional issues with the forced npm install. |
I'm having a similar issue as #3827 and the post on the forum here.
I just updated to 2.31.1 and now whenever I upload an image I get a 502 error. I'm using a DO droplet.
I tried debugging with
ghost run
but then it works. However, when I go back toghost start
it gives me 502s again.Technical details:
The text was updated successfully, but these errors were encountered: