VirtusLab-Open-Source/strapi-plugin-comments

Cannot read properties of undefined (reading 'id')

themtaysw opened this issue · 9 comments

Whenever I try to display a thread by clicking a button with eye icon (Drirrdown) I am left with blank white screen. The error in console says:

TypeError: Cannot read properties of undefined (reading 'id') at I (main.8ae5fa74.js:2762:2575) at Xu (main.8ae5fa74.js:3682:55163) at Kc (main.8ae5fa74.js:3686:9219) at Tc (main.8ae5fa74.js:3686:996) at _u (main.8ae5fa74.js:3686:924) at vs (main.8ae5fa74.js:3686:774) at Wo (main.8ae5fa74.js:3684:11323) at main.8ae5fa74.js:3682:39858 at n.unstable_runWithPriority (main.8ae5fa74.js:3728:3787) at Vs (main.8ae5fa74.js:3682:39632)
and the next one is the same:
main.8ae5fa74.js:2762 Uncaught TypeError: Cannot read properties of undefined (reading 'id') at I (main.8ae5fa74.js:2762:2575) at Xu (main.8ae5fa74.js:3682:55163) at Kc (main.8ae5fa74.js:3686:9219) at Tc (main.8ae5fa74.js:3686:996) at _u (main.8ae5fa74.js:3686:924) at vs (main.8ae5fa74.js:3686:774) at Wo (main.8ae5fa74.js:3684:11323) at main.8ae5fa74.js:3682:39858 at n.unstable_runWithPriority (main.8ae5fa74.js:3728:3787) at Vs (main.8ae5fa74.js:3682:39632)

I didnt do any modifications to the plugin, only using as-is. My config: (maybe my config is wrongly done idk)
comments: { enabled: true, config: { entryLabel: { "*": ["Title", "title", "Name", "name", "Subject", "subject"], "api::post.post": ["Comment"], "api::video.video": ["Comment"], "api::short.short": ["Comment"], }, reportReasons: { BAD_LANGUAGE: "BAD_LANGUAGE", }, }, },

Any help please?

@themtaysw thanks for reporting this issue. Are you able to provide more details about your setup?

  1. Environment (node js version, database type and version)
  2. Screenshot of Settings->Comments->Configuration

yes yes
so my env:
❯ yarn -v
1.22.19
❯ node -v
v16.12.0
"strapi-plugin-comments": "^2.2.4"
Screenshot 2023-02-01 at 8 42 03

Settings looks legit. Which DB you're using? And if I can ask you for example payload for comment response you're POST'ing. Maybe comments are not properly nested so drilldown fails.

So I am using MariaDB 10.5. and the payload is:

{content: "test thread",…} author : {id: 1, firstname: "Matej", lastname: "LN", username: "usrname, email: "email@email.com",…} blocked : false createdAt : "2022-02-19T16:35:31.380Z" email : "email" firstname : "Matej" id : 1 isActive : true lastname : "LN" preferedLanguage : "en" updatedAt : "2022-07-10T08:50:55.717Z" username : "username" content : "test thread"

(i edited the personal data)

edit:
so far i have been only adding comments from within the admin panel. I didnt code the option to add replies from users app yet

Ah you see, adding comments via admin Panel is not a way here because of custom logic for POST/PUT endpoints of the plugin exposed on client end.

That seems a reason of. Have you added them directly from the Moderation Panel via admin response (should not be possible) or using the Collections?

Screenshot 2023-02-01 at 9 07 43

i clicked this 😅

So seems something fails in admin response ;) Let us investigate your issue.

Fixed in v2.2.5

thanks really much❤️working now