strapi-plugin-comments: Comments are created, and can be fetched, but they are not loaded in Strapi

When I create comments through graphql it works as it should (with some queries missing, read below for this). But I get this error when trying to load comments in Strapi. This is the image

image

Any ideas what could be the issue? This is log in the console

TypeError: Cannot read properties of null (reading 'split')
    at getRelatedGroups (/home/m1ck0/Desktop/projects/portfolio-admin/node_modules/strapi-plugin-comments/server/services/utils/functions.js:52:42)
    at /home/m1ck0/Desktop/projects/portfolio-admin/node_modules/strapi-plugin-comments/server/services/common.js:198:55
    at Array.reduce (<anonymous>)
    at Object.findRelatedEntitiesFor (/home/m1ck0/Desktop/projects/portfolio-admin/node_modules/strapi-plugin-comments/server/services/common.js:197:31)
    at Object.findAll (/home/m1ck0/Desktop/projects/portfolio-admin/node_modules/strapi-plugin-comments/server/services/admin.js:137:63)
    at async returnBodyMiddleware (/home/m1ck0/Desktop/projects/portfolio-admin/node_modules/@strapi/strapi/lib/services/server/compose-endpoint.js:52:18)
    at async policiesMiddleware (/home/m1ck0/Desktop/projects/portfolio-admin/node_modules/@strapi/strapi/lib/services/server/policy.js:24:5)
    at async serve (/home/m1ck0/Desktop/projects/portfolio-admin/node_modules/koa-static/index.js:59:5)
    at async returnBodyMiddleware (/home/m1ck0/Desktop/projects/portfolio-admin/node_modules/@strapi/strapi/lib/services/server/compose-endpoint.js:52:18)
    at async policiesMiddleware (/home/m1ck0/Desktop/projects/portfolio-admin/node_modules/@strapi/strapi/lib/services/server/policy.js:24:5)
    at async /home/m1ck0/Desktop/projects/portfolio-admin/node_modules/@strapi/strapi/lib/middlewares/body.js:25:7
    at async /home/m1ck0/Desktop/projects/portfolio-admin/node_modules/@strapi/strapi/lib/middlewares/logger.js:22:5
    at async /home/m1ck0/Desktop/projects/portfolio-admin/node_modules/@strapi/strapi/lib/middlewares/powered-by.js:16:5
    at async cors (/home/m1ck0/Desktop/projects/portfolio-admin/node_modules/@koa/cors/index.js:56:32)
    at async /home/m1ck0/Desktop/projects/portfolio-admin/node_modules/@strapi/strapi/lib/middlewares/errors.js:13:7
    at async session (/home/m1ck0/Desktop/projects/portfolio-admin/node_modules/koa-session/index.js:41:7)

Also, these are all available queries and mutations for comments. Judging by the docs, some of them are missing, and are named incorrectly.

image

This is new Strapi installation.

I have custom config/env/production/database.js file with this content

const parse = require('pg-connection-string').parse;
const config = parse(process.env.DATABASE_URL);
module.exports = ({ env }) => ({
  connection: {
    client: 'postgres',
    connection: {
      host: config.host,
      port: config.port,
      database: config.database,
      user: config.user,
      password: config.password,
      ssl: {
        rejectUnauthorized: false
      },
    },
    debug: false,
  },
});

Node: 16.13.1 Strapi: 4.1.1 npm: 8.1.2 yarn: 1.22.17 OS: Linux

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 23

Most upvoted comments

Just putting this here for folks who can’t find their missing query types (i.e. findAllInHierarchy not in the schema/not queryable) with this setup. I had to explicitly add the collection types to Settings > Comments > General Configuration > Enable comments only for in order for the generated GQL code for the query types to be in the resulting schema + queryable through GQL.

Thats the dependency inside the GraphQL plugin so typical warning 😃

I’ve already asked question to Strapi team to check if there is a possibility to force plugins orders by their dependencies as Thats purely the issue. By this trick with plugins.js you are forcing the ordering.

As its solved, lets close the issue and I will keep eye this.

Finally reproduced it, looking for a solution. Expect it in 1-2 days hopefully