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
409 stars 64 forks source link

[CU-2ep5xe1] Warning: comments.app.components.notification.error #142

Closed kwiat1990 closed 2 years ago

kwiat1990 commented 2 years ago

Some time ago I started getting this warning (it pops up as snackbar while the view is loading) in the comments view inside Strapi dashboard. I don't know if it has something to do with deleted users and so on. Comments API itself does work and I can make every CRUD operations:

After everything settle down, this is all I can see:

image

Logs from Strapi:

error: Invalid populate field. Expected a relation, got text
Error: Invalid populate field. Expected a relation, got text
    at Object.processPopulate (/Users/mateusz.kwiatkowski/Playground/strapi4-mw/node_modules/@strapi/database/lib/query/helpers/populate.js:83:13)
    at Object.processState (/Users/mateusz.kwiatkowski/Playground/strapi4-mw/node_modules/@strapi/database/lib/query/query-builder.js:235:32)
    at Object.getKnexQuery (/Users/mateusz.kwiatkowski/Playground/strapi4-mw/node_modules/@strapi/database/lib/query/query-builder.js:271:12)
    at Object.execute (/Users/mateusz.kwiatkowski/Playground/strapi4-mw/node_modules/@strapi/database/lib/query/query-builder.js:352:25)
    at Object.applyPopulate (/Users/mateusz.kwiatkowski/Playground/strapi4-mw/node_modules/@strapi/database/lib/query/helpers/populate.js:207:12)
    at Object.execute (/Users/mateusz.kwiatkowski/Playground/strapi4-mw/node_modules/@strapi/database/lib/query/query-builder.js:357:25)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.findMany (/Users/mateusz.kwiatkowski/Playground/strapi4-mw/node_modules/@strapi/database/lib/entity-manager.js:132:22)
    at async Object.findAll (/Users/mateusz.kwiatkowski/Playground/strapi4-mw/node_modules/strapi-plugin-comments/server/services/admin.js:96:26)
    at async returnBodyMiddleware (/Users/mateusz.kwiatkowski/Playground/strapi4-mw/node_modules/@strapi/strapi/lib/services/server/compose-endpoint.js:52:18)
    at async policiesMiddleware (/Users/mateusz.kwiatkowski/Playground/strapi4-mw/node_modules/@strapi/strapi/lib/services/server/policy.js:24:5)
    at async serve (/Users/mateusz.kwiatkowski/Playground/strapi4-mw/node_modules/koa-static/index.js:59:5)
    at async returnBodyMiddleware (/Users/mateusz.kwiatkowski/Playground/strapi4-mw/node_modules/@strapi/strapi/lib/services/server/compose-endpoint.js:52:18)
    at async policiesMiddleware (/Users/mateusz.kwiatkowski/Playground/strapi4-mw/node_modules/@strapi/strapi/lib/services/server/policy.js:24:5)
    at async transform (/Users/mateusz.kwiatkowski/Playground/strapi4-mw/node_modules/strapi-plugin-transformer/server/middleware/transform.js:9:2)
    at async /Users/mateusz.kwiatkowski/Playground/strapi4-mw/src/middlewares/set-cookie.js:3:5

@cyp3rius could it be due to avatar field on user model, which I created and set it to string as I populate it with user avatars coming from login providers as string?

cyp3rius commented 2 years ago

Yep, that might be a case. Must check the implementation and your configuration.

kwiat1990 commented 2 years ago

I've added this new field on user to store URLs of user's avatars. Since they come as string from providers, I set the type of that field to text. Beside comment view in dashboard, I didn't notice any other problems. I think it should be fix on plugin's side as the returned value from the API for the avatar is a string. Otherwise it would be rather unusable for login providers.

cyp3rius commented 2 years ago

Agreed it's something we must fix, expect to manage it as part of 2.1.6 by this week.

kwiat1990 commented 2 years ago

Agreed it's something we must fix, expect to manage it as part of 2.1.6 by this week.

Cool, thank you!

cyp3rius commented 2 years ago

Released as part of v2.1.6.