Response code 405 (Method Not Allowed)


#1

Hi, there seems to be a broken process when publishing a new post related to the XMLRPC service. Every time I publish a new post (this is on a self hosted instance of Ghost), I see the following error in my logs. I have to publish the post a second time for it to actually work, otherwise I get 500 errors when trying to visit the post in my browser.

2018-07-10T15:15:17.328794+00:00 app[web.1]: INFO [2018-07-10 15:15:17] "PUT /build/ghost/api/v0.1/posts/5b44cd6c50d56b0015b4e720/?include=authors,tags,authors.roles" 200 129ms
2018-07-10T15:15:17.355616+00:00 app[web.1]: [2018-07-10 15:15:17] ERROR
2018-07-10T15:15:17.355620+00:00 app[web.1]:
2018-07-10T15:15:17.355622+00:00 app[web.1]: NAME: InternalServerError
2018-07-10T15:15:17.355624+00:00 app[web.1]: MESSAGE: Response code 405 (Method Not Allowed)
2018-07-10T15:15:17.355626+00:00 app[web.1]:
2018-07-10T15:15:17.355628+00:00 app[web.1]: level:normal
2018-07-10T15:15:17.355629+00:00 app[web.1]:
2018-07-10T15:15:17.355631+00:00 app[web.1]: The xmlrpc service was unable to send a ping request, your blog will continue to function.
2018-07-10T15:15:17.355634+00:00 app[web.1]: If you get this error repeatedly, please seek help on http://docs.ghost.org.
2018-07-10T15:15:17.355636+00:00 app[web.1]: InternalServerError: Response code 405 (Method Not Allowed)
2018-07-10T15:15:17.355638+00:00 app[web.1]: at new GhostError (/app/node_modules/ghost/core/server/lib/common/errors.js:9:26)
2018-07-10T15:15:17.355639+00:00 app[web.1]: at /app/node_modules/ghost/core/server/services/xmlrpc.js:75:38
2018-07-10T15:15:17.355641+00:00 app[web.1]: at tryCatcher (/app/node_modules/bluebird/js/release/util.js:16:23)
2018-07-10T15:15:17.355643+00:00 app[web.1]: at Promise._settlePromiseFromHandler (/app/node_modules/bluebird/js/release/promise.js:512:31)
2018-07-10T15:15:17.355645+00:00 app[web.1]: at Promise._settlePromise (/app/node_modules/bluebird/js/release/promise.js:569:18)
2018-07-10T15:15:17.355646+00:00 app[web.1]: at Promise._settlePromise0 (/app/node_modules/bluebird/js/release/promise.js:614:10)
2018-07-10T15:15:17.355648+00:00 app[web.1]: at Promise._settlePromises (/app/node_modules/bluebird/js/release/promise.js:689:18)
2018-07-10T15:15:17.355650+00:00 app[web.1]: at Async._drainQueue (/app/node_modules/bluebird/js/release/async.js:133:16)
2018-07-10T15:15:17.355651+00:00 app[web.1]: at Async._drainQueues (/app/node_modules/bluebird/js/release/async.js:143:10)
2018-07-10T15:15:17.355653+00:00 app[web.1]: at Immediate.Async.drainQueues (/app/node_modules/bluebird/js/release/async.js:17:14)
2018-07-10T15:15:17.355655+00:00 app[web.1]: at runCallback (timers.js:810:20)
2018-07-10T15:15:17.355657+00:00 app[web.1]: at tryOnImmediate (timers.js:768:5)
2018-07-10T15:15:17.355658+00:00 app[web.1]: at processImmediate [as _immediateCallback] (timers.js:745:5)
2018-07-10T15:15:17.355660+00:00 app[web.1]:
2018-07-10T15:15:17.355661+00:00 app[web.1]: HTTPError: Response code 405 (Method Not Allowed)
2018-07-10T15:15:17.355663+00:00 app[web.1]: at stream.catch.then.data (/app/node_modules/got/index.js:182:13)
2018-07-10T15:15:17.355665+00:00 app[web.1]: at tryCatcher (/app/node_modules/bluebird/js/release/util.js:16:23)
2018-07-10T15:15:17.355667+00:00 app[web.1]: at Promise._settlePromiseFromHandler (/app/node_modules/bluebird/js/release/promise.js:512:31)
2018-07-10T15:15:17.355668+00:00 app[web.1]: at Promise._settlePromise (/app/node_modules/bluebird/js/release/promise.js:569:18)
2018-07-10T15:15:17.355670+00:00 app[web.1]: at Promise._settlePromise0 (/app/node_modules/bluebird/js/release/promise.js:614:10)
2018-07-10T15:15:17.355672+00:00 app[web.1]: at Promise._settlePromises (/app/node_modules/bluebird/js/release/promise.js:693:18)
2018-07-10T15:15:17.355673+00:00 app[web.1]: at Async._drainQueue (/app/node_modules/bluebird/js/release/async.js:133:16)
2018-07-10T15:15:17.355675+00:00 app[web.1]: at Async._drainQueues (/app/node_modules/bluebird/js/release/async.js:143:10)
2018-07-10T15:15:17.355677+00:00 app[web.1]: at Immediate.Async.drainQueues (/app/node_modules/bluebird/js/release/async.js:17:14)
2018-07-10T15:15:17.355678+00:00 app[web.1]: at runCallback (timers.js:810:20)
2018-07-10T15:15:17.355680+00:00 app[web.1]: at tryOnImmediate (timers.js:768:5)
2018-07-10T15:15:17.355681+00:00 app[web.1]: at processImmediate [as _immediateCallback] (timers.js:745:5)

#2

Yep


#3

That sounds completely unrelated to the xmlrpc ping error (that is just a background process and has no bearing on the save/publication). Do you have the logs from the 500 errors you’re seeing?


#4

So here are the series of events that cause the 500.

When I try to create a new story/post in Ghost (self hosted on Heroku using the https://github.com/cobyism/ghost-on-heroku project), I get the xmlrpc error, and then when I try to visit the newly created post, I then get the 500.

However, if I publish the post a second time, it seems to then work fine.

Logs:


#5

This is caused by the broken xmlrpc ping domain tracked here:

There is already a PR for it, will be released soon.

You can ignore the error log for now, it does not affect post creation or editing, it’s just a log telling that something isn’t working.


#6

Any idea why I need to “publish” my posts twice for them to show up? On initial publish, I get the xmlrpc error, and trying to visit the post results in a 500 (Resource Not Found)… when I hit publish a second time, it seems to work. Hmmmm. related?


#7

I am not sure what you mean exactly :thinking:

If the post goes live (from draft to publish), an event will be triggered and this triggers the xmlrpc ping. If the post is already live and you just save/update the post, no publish event is triggered, because the post is already published.


#8

Basically this is what happens:

  • Create new post/story by hitting Publish
  • Try to visit the newly published post and get a 500 error (Resource not found)
  • Hit Publish again on the same post
  • Try to visit the newly published post and it loads just fine

When looking through the logs, I see 2 errors, which I’ve linked to in this gist:

I am not sure if its related to the xmlrpc ping or not. Could be unrelated, but whatever is happening, it requires me to publish my posts twice for them to work


#9

No this doesn’t sound related. Which Ghost version are you on?
You are getting a 500 when visiting the post on your blog, correct? Can you please share a screenshot from this error? Furthermore, i wonder why you only see the xmlrpc error in your log. Could you please double check that there is no other error? Thanks :slight_smile:


#10

The weirdest thing happens, Kate. About 50% of the time, the post loads and the other 50% returns a 500. I’ve recorded a video of it here:

CloudApp

I’ve also noticed that this newly created post doesn’t always show up on the homepage. If I keep refreshing, sometimes it shows up, other times it doesn’t. Interestingly, if I restart the server, everything seems to work fine. Its almost like all of the Ghost instances are not in sync (I am running this on Heroku with 2 dynos, so the node app is being forked into 2 processes.) Do I need to do something special to make the Ghost app work with a forked process?


#11

Thanks for coming back.

From https://docs.ghost.org/docs/install

Ghost does not support clustering or multi-server setups of any description, there should only be one Ghost instance per blog. The recommended scaling and performance approach is to put a cache and/or CDN in front of your blog; pages generated by Ghost are essentially static so there should be very little traffic hitting your Ghost server with a well configured cache.


#12

Ahh, good to know. thanks! I just scaled down to one process and things seem to be working better now.