There was an error returning the category list from Discourse

AI-generated summary

A user reported an error when publishing a WordPress post to Discourse after updating to the latest version, resulting in a failed category list retrieval. The error logs indicated an API authentication issue with the message “You are not permitted to view the requested resource. The API username or key is invalid.” Brandon007 discovered that the system user ID had unexpectedly reverted to the default “system” name, which caused the authentication failure. After manually reverting the system user ID back to the custom name, the issue was resolved. Brandon007 suspects this was a bug introduced in the recent Discourse update.

I just updated Discourse to the latest and greatest last night. This morning when I went to publish a new Wordpress post, I receive this error.

I was able to publish the post from Wordpress to the forum, but not with the proper topic. I can add a tag and it will show up within the post on the forum.

Looking in the logs I see this:

[2023-05-12 16:54:03] webhook_topic.ERROR: update_topic_content.response_body_error
[2023-05-12 16:54:52] webhook_topic.ERROR: update_topic_content.response_body_error

Is this a bug with the latest version, any ideas?

Is wp-discourse also up to date? (I don’t use it myself, so this is the most useful idea I’ll have to offer)

It sure is. :thinking:

So we’re all on the same page:

Discourse: 3.1.0.beta4
WP-Discourse: Version 2.4.9

I wanted to provide an update on this. I turned on logging for everything and took a closer look and found this error.

2023-05-19 16:11:08] connection.INFO: check_connection_status.failed_to_connect {"error":"wpdc_response_error","message":"An invalid response was returned from Discourse","http_code":403,"http_body":"{\"errors\":[\"You are not permitted to view the requested resource. The API username or key is invalid.\"],\"error_type\":\"invalid_access\"}”}

This stood out to me, “The API username or key is invalid.”

Somehow, my main system user ID changed after the update I recently did… I had previously set it to a custom name, something other than “system.” However, when I went back in and took a look, I see the system user had defaulted back to “system.” So I changed it back to the custom name I had and everything is working.

I know I didn’t change it back to the default name of “system” and I’m the only person with access. I think this was a bug with the latest and greatest update. All is well now though.