VirtusLab-Open-Source / strapi-plugin-comments

A plugin for Strapi Headless CMS that provides end to end comments feature with their moderation panel, bad words filtering, abuse reporting and more.
MIT License
405 stars 63 forks source link

Dashboard Error 500: comments.app.components.notification.error #146

Closed matepaiva closed 1 year ago

matepaiva commented 2 years ago

Debug process

  1. When I visit /admin/plugins/comments/discover to see the comments, a lot of errors happens with the same message as the image below.
  2. I have published and pending comments and I can GET them via API, so that part is working as expected.
  3. The plugin is making a GET request to /comments/moderate/all and that request is returning status 500. I think the problem is there.
  4. Therefore, I verified the log and found the following error: selectt0.* fromarticlesast0where (t0.idin (124260, NaN)) - ER_BAD_FIELD_ERROR: Unknown column 'NaN' in 'where clause' Error: ER_BAD_FIELD_ERROR: Unknown column 'NaN' in 'where clause'
  5. Here you can see the API GET response that is working fine: https://data.anteprojectos.com.pt/api/comments/api::article.article:124260/flat/

Note: The problem only happens at the backoffice and does not affect the API.

I hope the info above helps you with the debug process :)

image

cyp3rius commented 2 years ago

@matepaiva

can you please provide the article collection you're using and how many of them you've got created? That seems for me like a limit issue as NaN appears in the automated DB query.

Also plugin config is going to be welcome.

matepaiva commented 2 years ago

Thanks for investigating it with me!

khocef commented 2 years ago

i have the exact same error, what i did is add subcomment and then delete the parent thread.

cyp3rius commented 2 years ago

i have the exact same error, what i did is add subcomment and then delete the parent thread.

@khocef you've deleted the thread in database? Or using the delete endpoint of client service?

khocef commented 2 years ago

@cyp3rius using the delete endpoint

remove(commentId: number, pageId: number, authorId: number): Observable<any> {
    return this.http.delete(`http://localhost:1337/api/comments/api::page.page:${pageId}/comment/${commentId}?authorId=${authorId}`);
}
cyp3rius commented 2 years ago

Thanks for confirming, will check that also

cyp3rius commented 2 years ago

@khocef this issue somehow has been fixed in v2.1.7, can you check and confirm?

@matepaiva still working on a big set of entities.

khocef commented 2 years ago

@cyp3rius thank you a lot, its working great now <3

engineers-dope commented 1 year ago

It's happening again in v2.2.1. The error occurs as soon as I have at least one comment. It doesn't show this error when I removed and reinstalled the plugin without any comments.

image

Here is my settings

image

I tried deleting all comments, remove plugin and reinstall, but still no luck at all.

My temporary workaround now is to do this in the lib (add ? to populate.count => populate?.count) @strapi/database/lib/query/helpers/populate/apply.js image

cyp3rius commented 1 year ago

@Dope-Engineers case with large set of comments is exactly what we already found but it is a modification in the Strapi core libs. We are working on some custom solution here, directly in a plugin

betoflakes commented 1 year ago

Sitll happening . The last update brokes my extensions too. We really are waiting your update.,

OliveiraCleidson commented 1 year ago

I had the same issue so I updated to version 2.2.4 and it worked too.

cyp3rius commented 1 year ago

Closing as seems to be fixed in recent releases.