Weird bug with discourse-assign

We have this random topic on our forum that has somehow managed to become invisible. Deleting and restoring the topic via tha API has had no effect. It seems like discourse-assign causes it to fail to load, as it loads perfectly fine when plugin JS is disabled using safe mode.
You can find this buggy post here:

Here’s a stack trace for one of the errors we get when opening the topic:

Cannot read properties of undefined (reading 'includes')
at n.<anonymous> (https://amcforum.wiki/assets/plugins/discourse-assign-e7635afd56f3ebe38bb2866d6121e1e726de50fbfc472646a6e738a3d44b3930.js:208:1008)
at https://amcforum.wiki/assets/discourse-12f38708c935010f61959d1ee5b74a9770c91ed393b88e3a7a5fe0a3de467a89.js:9931:74
at Array.forEach (<anonymous>)
at n.buildClasses (https://amcforum.wiki/assets/discourse-12f38708c935010f61959d1ee5b74a9770c91ed393b88e3a7a5fe0a3de467a89.js:9931:51)
at n.draw (https://amcforum.wiki/assets/discourse-12f38708c935010f61959d1ee5b74a9770c91ed393b88e3a7a5fe0a3de467a89.js:10348:34)
at n.render (https://amcforum.wiki/assets/discourse-12f38708c935010f61959d1ee5b74a9770c91ed393b88e3a7a5fe0a3de467a89.js:10324:54)
at a (https://amcforum.wiki/assets/chunk.660.cfa44cc656d26c5d04fa-3aa2531cc98e968234ee473ed8fc2ef14895f4ba22e888d7d542e7d3620f8056.js:331:20)
at e.exports (https://amcforum.wiki/assets/chunk.660.cfa44cc656d26c5d04fa-3aa2531cc98e968234ee473ed8fc2ef14895f4ba22e888d7d542e7d3620f8056.js:333:34)
at e (https://amcforum.wiki/assets/chunk.660.cfa44cc656d26c5d04fa-3aa2531cc98e968234ee473ed8fc2ef14895f4ba22e888d7d542e7d3620f8056.js:337:6)
at Object.e [as render] (https://amcforum.wiki/assets/chunk.660.cfa44cc656d26c5d04fa-3aa2531cc98e968234ee473ed8fc2ef14895f4ba22e888d7d542e7d3620f8056.js:342:48)
at https://amcforum.wiki/assets/chunk.660.cfa44cc656d26c5d04fa-3aa2531cc98e968234ee473ed8fc2ef14895f4ba22e888d7d542e7d3620f8056.js:976:62
at e.exports (https://amcforum.wiki/assets/chunk.660.cfa44cc656d26c5d04fa-3aa2531cc98e968234ee473ed8fc2ef14895f4ba22e888d7d542e7d3620f8056.js:977:40)
at u (https://amcforum.wiki/assets/chunk.660.cfa44cc656d26c5d04fa-3aa2531cc98e968234ee473ed8fc2ef14895f4ba22e888d7d542e7d3620f8056.js:952:8)
at Object.l [as patch] (https://amcforum.wiki/assets/chunk.660.cfa44cc656d26c5d04fa-3aa2531cc98e968234ee473ed8fc2ef14895f4ba22e888d7d542e7d3620f8056.js:949:3)
at e.exports (https://amcforum.wiki/assets/chunk.660.cfa44cc656d26c5d04fa-3aa2531cc98e968234ee473ed8fc2ef14895f4ba22e888d7d542e7d3620f8056.js:981:29)
at u (https://amcforum.wiki/assets/chunk.660.cfa44cc656d26c5d04fa-3aa2531cc98e968234ee473ed8fc2ef14895f4ba22e888d7d542e7d3620f8056.js:952:8)
at Object.l [as patch] (https://amcforum.wiki/assets/chunk.660.cfa44cc656d26c5d04fa-3aa2531cc98e968234ee473ed8fc2ef14895f4ba22e888d7d542e7d3620f8056.js:949:3)
at e (https://amcforum.wiki/assets/chunk.660.cfa44cc656d26c5d04fa-3aa2531cc98e968234ee473ed8fc2ef14895f4ba22e888d7d542e7d3620f8056.js:953:114)
at e.rerenderWidget (https://amcforum.wiki/assets/discourse-12f38708c935010f61959d1ee5b74a9770c91ed393b88e3a7a5fe0a3de467a89.js:1844:163)
at p.invoke (https://amcforum.wiki/assets/vendor-d19c5d3106737be843b2f1f98da81f661a0e985585b4a1fd14cab77cbfa60e37.js:4339:182)
at p.flush (https://amcforum.wiki/assets/vendor-d19c5d3106737be843b2f1f98da81f661a0e985585b4a1fd14cab77cbfa60e37.js:4331:141)
at h.flush (https://amcforum.wiki/assets/vendor-d19c5d3106737be843b2f1f98da81f661a0e985585b4a1fd14cab77cbfa60e37.js:4346:207)
at q._end (https://amcforum.wiki/assets/vendor-d19c5d3106737be843b2f1f98da81f661a0e985585b4a1fd14cab77cbfa60e37.js:4410:9)
at _boundAutorunEnd (https://amcforum.wiki/assets/vendor-d19c5d3106737be843b2f1f98da81f661a0e985585b4a1fd14cab77cbfa60e37.js:4358:595)
3 Likes

yea the console is showing errors here.

1 Like

Its a small action with no action code!

You can fix this using the console, enter the container find the small actions on the topic, one of them is missing an action code.

We should probably add a sql validation to ensure this is impossible.

3 Likes

I think those can be created using the API (we have a theme component that creates one), will we have to manually run some kind of database migration?

1 Like

Here’s an example of another one created using our theme component:

1 Like

It seems like 25 different topics all have posts that are breaking discourse-assign, according to the results of this SQL query (using data explorer):

SELECT id topic_id FROM topics topic WHERE topic.id IN (SELECT topic_id FROM posts WHERE post_type = 3 AND action_code IS NULL)
2 Likes

GPT bot to the rescue…

2 Likes

If that’s the check, why not just add !!post.actionCode to the if block?

1 Like

Finally got around to this, and PR’d a change:

3 Likes