Plugin causing errors during rebuild

What is happening here is this

  1. Some people have a very old version of the question answer plugin with my personal github username in the repository URL in their app.yml file.

  2. I transferred the QnA plugin to paviliondev years ago. Github redirects repository URLs when they’re transferred, so the old urls with my personal username in it kept working.

  3. More years later Pavilion transferred the Question Answer Plugin to Discourse. Discourse initially kept the name discourse-question-answer.

  4. A few months ago I created my own fork of the plugin hosted in discourse, while it was still called discourse-question-answer.

  5. People with very old links to the QnA plugin with my personal github account in them were now cloning my new fork of the significantly updated discourse-question-answer hosted in discourse. In other words a very old link was now pointing to a fork of a new plugin. Despite the intervening years, I should have forseen that, so apologies for that. I’ve removed that fork.

  6. Discourse changed the name of discourse-question-answer to discourse-upvotes. This change of name has not had a material impact on your case @Jaap-Jan_Swijnenburg, but it’s why you’re now (unexpectedly) cloning a fork of that repo.

  7. A migration in discourse/discourse-upvotes (ex discourse-question-answer) assumes the value column in post_custom_fields is type-safe as JSON.

  8. Old data created by the plugin when it was angusmcleod/discourse-question-answer (years ago) was not saved as valid JSON by the HasCustomFields concern in discourse/discourse. I’m guessing, but this data was probably added before JSON type-checking was added 4 years ago (It’s still possible to end up with invalid JSON in custom fields registered as JSON in edge cases).

Therefore

  1. When people with the (years-out-of-date) angusmcleod/discourse-question-answer url in their app.yml update their Discourse the migration in the new version of the plugin is cloned, the migration runs and potentially creates this error.

There are a few solutions to this:

  1. @Jaap-Jan_Swijnenburg in your case you just need to remove the reference to my old QnA plugin and you’ll be able to rebuild your site. That’s it; nothing more. Looks like that’s what you’ve done :+1:

  2. The discourse/discourse-upvotes plugin migration could be updated to handle non-JSON values in the value column in post_custom_fields.

I’d note that 2 would also handle the additional case of people who do indeed want to switch from the an old version of the QnA plugin to discourse-upvotes. In that case the migration will run and it will fail if any entries in the value column of post_custom_fields are not valid JSON.

5 Likes