WP Discourse "Update Discourse topic" error


#1

Hi,

I am create blog post and linked existing topic. Discourse topic not updated, blog post url not seems on the topic.

Also, i tried “Update Discourse topic” on Wordpress panel. It gives me error:

There has been an error publishing this post to Discourse.

Reason for failure:
A 422 response code was returned from Discourse.
Unprocessable Entity

Any ideas?


(Simon Cossar) #2

When you link a post to a Discourse topic, it does not update the topic until you select the ‘Update Discourse topic’ checkbox. Linked posts do not add the blog URL to the Discourse topic.

Can you try this with another post and see if you get the same error?


#3

I selected ‘Update Discourse topic’ checkbox. When i tried another post, it works.


(Simon Cossar) #4

Thanks for trying that! Can you give any details about the post that is returning the 422 error? Does the topic that it is linked to exist on your forum?


(Quim Gil) #5

We are finding this problem right now, and I think I can contribute to this discussion. What happened in our case is:

  1. An article is published in WordPress and a related topic is automatically created in Discourse.
  2. However, for whatever reason (user post limit?), the new topic goes automatically to moderation.
  3. The moderated topic is not public, The WP-Discourse plugin cannot “see it” and throws a first error message: Reason for failure: A bad response was returned from Discourse. Check that: - your Discourse forum is online.

If the moderator approves the post because everything is correct there, then…

When updating the article in WordPress in order to have a Discourse topic linked, the WP-Discourse plugin finds an article with an identical title / content, and this is what cause a second error message:

Reason for failure:
A 422 response code was returned from Discourse.
Unprocessable Entity

The solution is to delete the first Discourse topic and update the page again.


(Simon Cossar) #6

Thanks for mentioning this. If a post that is published to Discourse gets added to the Needs Approval queue, the WordPress plugin should give some feedback about how to deal with it.

After the post has been approved you can also select the ‘Link to Existing Topic’ option from the post’s Discourse metabox. In the Topic URL field, enter the URL of the approved Discourse topic.


(Quim Gil) #8

Yeah, I wonder why occasionally a post of these goes to moderation. It is sent by a trusted user. Maybe there is some kind of throttle? Several posts might be queued in WordPress, and then an administrator reviews them and might approve several of them pretty quickly.

Not in our case because we have the “Force publish” option enabled. Therefore the metabox only says.

The force-publish option has been enabled. All WordPress posts will be published to Discourse in the Kaosenlared category.

Once you know what is going on, it is not a big deal.


(Simon Cossar) #9

When posts that are published from WordPress to Discourse get added to the Discourse approval queue, the user publishing the post should now see this message:

01%20PM

When the topic is approved on Discourse and the Topic URL is updated on WordPress, they will see this:

23%20PM

Let me know if you are finding any posts that are added to the approval queue on Discourse but are not displaying this message on WordPress.


(jrgong) #10

I have a similar issue in combination with a glossary plugin
Whenever I try to create a new topic from the post or update it, I get the same error:

A 422 response code was returned from Discourse. Unprocessable Entity

Also my server’s CPU goes crazy and my DB cannot be reached for a minute or two.

Any way I can debug that?


(Simon Cossar) #11

Are you able to publish any posts when the glossary plugin is enabled? What is the name of the plugin? Are you using the WordPress Block Editor, or the old Classic Editor?


(jrgong) #12

I am using the classic editor
Plugin: [Brilliant] WordPress Tooltip Glossary, Dictionary & Knowledge Base Plugin

Yes. As long as the[glossary] shortcode is not in the post, it works fine.


(Simon Cossar) #13

How large is the glossary you were adding? I just tried the plugin with two items in the glossary and adding the shortcode to a post didn’t cause a problem.


(jrgong) #14

around 70 entries are in it