Cannot Post to Discourse instance, Published Category does not Display in settings


(Josiah Toppin) #1

Hi all,

I’m receiving a number of different errors as per the logs depending on which page I’m on as per the following:

Posting a post:

2016/01/18 12:52:51 [error] 4319#0: *3320 FastCGI sent in stderr: “PHP message: PHP Warning: First parameter must either be an object or the name of an existing class in /var/www/josiahtoppin.com/htdocs/wp-content/plugins/wp-discourse-0.6.6/lib/discourse.php on line 507” while reading response header from upstream, client: 142.229.86.182, server: josiahtoppin.com, request: “POST /wp-admin/post.php HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9000”, host: “www.josiahtoppin.com”, referrer: “http://www.josiahtoppin.com/wp-admin/post.php?post=8587&action=edit

Loading the plugin page:

2016/01/18 12:59:35 [error] 4319#0: *3420 FastCGI sent in stderr: “PHP message: PHP Warning: Invalid argument supplied for foreach() in /var/www/josiahtoppin.com/htdocs/wp-content/plugins/wp-discourse-0.6.6/lib/admin.php on line 257” while reading response header from upstream, client: 142.229.86.182, server: josiahtoppin.com, request: “GET /wp-admin/options-general.php?page=discourse HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9000”, host: “www.josiahtoppin.com”, referrer: “http://www.josiahtoppin.com/wp-admin/options-general.php?page=discourse

And loading a post page:

2016/01/18 12:54:15 [error] 4319#0: *3363 FastCGI sent in stderr: "PHP message: PHP Warning: First parameter must either be an object or the name of an existing class in /var/www/josiahtoppin.com/htdocs/wp-content/plugins/wp-discourse-0.6.6/lib/discourse.php on line 507

PHP message: A valid URL was not provided" while reading response header from upstream, client: 142.229.86.182, server: josiahtoppin.com, request: “GET /2016/01/we-shall-get-this-working/ HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9000”, host: “www.josiahtoppin.com”, referrer: “http://www.josiahtoppin.com/blog/

For some reason, I have a feeling that this may be linked to the way I have my wordpress/discourse configured in nginx, but who knows, I could be wrong on that front. For reference, I’m using a setup similar to this: Nginx + discourse. This is also a similar problem: Wp-discourse dysfunctional, shows only “Start the discussion at ...”, but none of the suggestions there seemed to have helped with my case.

Discourse settings:
Discourse URL
Full url is set properly (http:// discourse.josiahtoppin.com (that space isn’t there, I can only post two links here as for being a new user)
API Key


Publishing username
Josiah.Toppin

I’ve regenerated the api key a number of times and have also ensured that the user posting the post has the correct Discourse username setup in the discourse environment. I’m at a bit of a brick wall at this point.

SSO is working properly using the separate plugin. SSO using this plugin seemed to break things.


(Josiah Toppin) #2

Hello everyone; I’ve played around with a few different nginx configurations and that hasn’t helped. I’ve taken a look at the firewall rules I have set up and that doesn’t seem to be an issue, but I’m not an expert when it comes to iptables. I will do a bit more testing and see if I can’t resolve. For some reason, I think it might be related to my firewall, but I can’t be sure.


(Steven Greco) #3

With fastcgi errors might want to check you php.ini settings. Do you have
furlopen set to 1? Also I noticed it’s trying to open both
www.josiahtoppin.com and josiahtoppin.com. Do you have DNS setup for the
non-www address or are you doing a rewrite rule?

Just tying to think of things to check.

Do you use easy engine btw?


(Josiah Toppin) #4

I am using easy engine. I was about to jump in and try the other advice until I saw that you mentioned that and thought it would be pertinent to mention before delving deeper into this issue. @Grex315 I’m still learning discourse; do I need to mention people in replies?

Edit: Furl is on and dns is setup for the non-www address - www is added via wordpress site address.


(Steven Greco) #5

nah. dont think Easy engine would cause an issue just recognized the path setup. I use EE as well but just so i can get their NGINX repo. They have all the modules I want already built in. The rest I setup myself.

Have you try disabiling all other plugins.and just have this one going to see if there is a conflict? Also in the plug in settings for the category drop down is it showing a populated list of categories or is it blank? That would tell you if your API key is working and the plugin is connecting to your discourse instance,


(Josiah Toppin) #6

Hmm. No joy on disabling plugins - still no go.

Nope, drop down is blank, so it is definitely not connecting.

Played around with some temp firewall rules and nothing seemed to do the trick. I’m at a bit of a wall here. I posted it over at rtcamp and opened an issue up on github in the mean time though.


(Josiah Toppin) #7

Well. Good news and bad news.

Good news is I got it working through the embeddable settings with an RSS feed and using this: GitHub - techAPJ/wp-discourse-embed: WordPress plugin that lets you use Discourse as the community engine for a WordPress blog plugin.

Bad news is I had to ditch the regular wp-discourse plugin for now.

Now if only I can figure out why the topics aren’t being posted to the specified category in my embeddable settings. That is for another topic though.


(Steven Greco) #8

Ok. Glad you got something to work.

I was going to suggest was using and admin account or just putting system
in as the username creating the posts.