502 Error after updating to v2

ghost log looks all normal except occational bootstrap socket warning[2019-08-06 16:00:40] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED [2019-08-06 16:00:40] WARN Tries: 2 [2019-08-06 16:00:40] WARN Retrying... [2019-08-06 16:00:40] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED

content/logs/xxxx.error.log also doesn’t seem to have anything related:

Log message

{"name":"Log","hostname":"ghost-1gb-lon1-01","pid":22115,"level":50,"err":{"id":"ff065dd0-b7e2-11e9-b21e-27ab7c4b8eeb","domain":"https://www.perfocal.com/blog","code":"IMAGE_SIZE_URL",$ {"name":"Log","hostname":"ghost-1gb-lon1-01","pid":22115,"level":50,"err":{"id":"607105b0-b7ee-11e9-b21e-27ab7c4b8eeb","domain":"https://www.perfocal.com/blog","code":"IMAGE_SIZE_URL",$ {"name":"Log","hostname":"ghost-1gb-lon1-01","pid":22115,"level":50,"err":{"id":"17e6be20-b816-11e9-b21e-27ab7c4b8eeb","domain":"https://www.perfocal.com/blog","code":"IMAGE_SIZE_URL",$ {"name":"Log","hostname":"ghost-1gb-lon1-01","pid":22115,"level":50,"err":{"id":"a895ed60-b816-11e9-b21e-27ab7c4b8eeb","domain":"https://www.perfocal.com/blog","code":"IMAGE_SIZE_URL",$ {"name":"Log","hostname":"ghost-1gb-lon1-01","pid":25170,"level":50,"req":{"meta":{"requestId":"7ca10212-213d-433d-834c-7c10ee98f38b","userId":null},"url":"/users/me/?include=roles","m$ {"name":"Log","hostname":"ghost-1gb-lon1-01","pid":25170,"level":50,"req":{"meta":{"requestId":"93c137b0-30dd-410a-8997-f662aabdf89c","userId":null},"url":"/users/me/?include=roles","m$ {"name":"Log","hostname":"ghost-1gb-lon1-01","pid":25170,"level":50,"req":{"meta":{"requestId":"25088877-d99e-4a6c-9d05-f592701268de","userId":null},"url":"/users/me/?include=roles","m$ {"name":"Log","hostname":"ghost-1gb-lon1-01","pid":25170,"level":50,"req":{"meta":{"requestId":"d259f43b-a17f-47e6-8a71-de3a6f3b94ad","userId":null},"url":"/users/me/?include=roles","m$ {"name":"Log","hostname":"ghost-1gb-lon1-01","pid":25395,"level":50,"req":{"meta":{"requestId":"ebc8c1f0-b85e-11e9-b180-57ed8e51868a","userId":null},"url":"/posts/?limit=30&page=1&filt$ {"name":"Log","hostname":"ghost-1gb-lon1-01","pid":25640,"level":50,"req":{"meta":{"requestId":"93f45ce0-b85f-11e9-b476-097d946872ea","userId":"5c6c09a7c01ffe7017976daf"},"url":"/posts$ {"name":"Log","hostname":"ghost-1gb-lon1-01","pid":25818,"level":50,"req":{"meta":{"requestId":"b8ca7270-b85f-11e9-b7ec-4d4e6d0b53ce","userId":"5c6c09a7c01ffe7017976daf"},"url":"/posts$ $ons/2.27.0/node_modules/express/lib/application.js:230:10)"},"msg":"Site is starting up, please wait a moment then retry.","time":"2019-08-06T15:50:42.559Z","v":0}

Just realised that I did not paste the full message. But it does not seem to have logged relevant info there?

The blog is up and running, and sends emails with not problem. It’s just image uploading issue. We’ve checked folder permissions, it looks like user ghost has sufficient permissions. Also ghost doctor says everything is good! :thinking:

Many thanks!

All I can see so far is that two requests errored with a 502:

Part way through your stack trace I can see:

vendor.min-b2f8edd0972fea6d8bd360ed183797f6.js:10161 Uncaught TypeError: Cannot read property ‘url’ of undefined

And in the error log I can see parts of errors:

“code”:“IMAGE_SIZE_URL”,

This is super weird, but it’s not enough information to debug the problem

Try looking in the non error ghost log, and look for reference to those 2 requests.

You can also try looking in /var/log/nginx/error.log.

1 Like

Nginx error log:

......
2019/08/06 19:25:07 [error] 5255#0: *2261264 open() "/opt/statics/public/wp-login.php" failed (2: No such file or directory), client: 197.62.xxx.xx, server: www.domain.com, request: "GET /wp-login.php HTTP/1.1", host: "www.domain.com"
2019/08/06 19:34:09 [error] 5255#0: *2261286 upstream prematurely closed connection while reading response header from upstream, client: 194.75.xxx.xxx, server: www.domain.com, request: "POST /blog/ghost/api/v2/admin/images/upload/ HTTP/2.0", upstream: "http://46.101.xx.xx:2368/blog/ghost/api/v2/admin/images/upload/", host: "www.domain.com", referrer: "https://www.domain.com/blog/ghost/"

So we’re hosing Ghost on a separate droplet (and as a subdirectory). This error log is from the main site’s nginx.

was debugging with ghost run instead of ghost start and it just worked… so weird!! now switching back to ghost start and see…

and now the issue is back… :man_facepalming:

1 Like

I have the same issue here!

1 Like

I have the exact same issue. I just updated to 2.31.1. I can’t upload images without a 502 error. When I debug in ghost run it works perfectly. Then I go to ghost start and it 502’s again.

Whenever I try to upload an image it gives me an error and the blog restarts on the server side.

Update: I rolled back my version to 2.30.2 and it started working again.

Hmmm ok - is anyone able to find anything relevant in the Ghost log? Logs are kept in /content/logs.

@Juan_Carlos_Orrego are you also on a subdirectory?

FYI - I tried updating to the latest version again and now I’m getting a specific error from ghost run. I’ve posted the output here: 502 on image upload, but works fine with `ghost run` · Issue #11129 · TryGhost/Ghost · GitHub. I rolled back to 2.30.2 and it works fine.

Nevermind, v.2.34.0 fixed my 500 error issue. However, now my 502 error on image upload (not occuring during ghost run ) is back :frowning:

I am getting the same error. I am running 2.34.0 and the error is returning with a 502.

@ekerstein This is really weird. Can you double check ghost doctor for me, and also take a look at your current/node_modules folder and see if sharp is in there?

@bencstrs is this only on image upload? If not can you please start a new thread with full details and logs?

P.S. @ekerstein I’ve reopened 502 on image upload, but works fine with `ghost run` · Issue #11129 · TryGhost/Ghost · GitHub

Hi Hannah,

Yep it is only on image upload.

@bencstrs Same questions to you then :slight_smile: Can you check ghost doctor and also take a look at your current/node_modules folder and see if sharp is in there?

Sure, here is the ghost doctor output:

✔ Checking system Node.js version
✔ Checking logged in user
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
✔ Checking operating system compatibility
✔ Checking for a MySQL installation
+ sudo systemctl is-active ghost_example-com
Instance is currently running
ℹ Validating config [skipped]
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability

I checked node_modules and I do see a sharp folder in there.

FYI - I added some more notes to the GitHub issue. It does seem to be an issue with the sharp package.