VirtusLab-Open-Source / strapi-plugin-reactions

All-in-One reactions plugin for any Content Type. Simple & flexible.
MIT License
12 stars 1 forks source link

Error: Id was already defined and imported as a type, check the docs for extending types #10

Closed janlew closed 11 months ago

janlew commented 1 year ago

When I add reactions: { enabled: true, }, to my code I got Error: Id was already defined and imported as a type, check the docs for extending types

without it it seems like reactions are working, but I can't use graphql queries and mutation (reactionKinds, reactionsListAll, reactionSet). They are just not available. I had similar problem with your comments plugin, but in that case adding "comments" to config/plugins.ts fixed issue. In that case adding "reactions" to config/plugins.ts make things worse :<

cyp3rius commented 1 year ago

Checking. Can you drop here your package.json and plugins.js to let me replicate the issue?

janlew commented 1 year ago

@cyp3rius

{
  "name": "project",
  "private": true,
  "version": "0.1.0",
  "description": "A Strapi application",
  "scripts": {
    "dev": "strapi develop",
    "start": "strapi start",
    "build": "strapi build",
    "strapi": "strapi"
  },
  "dependencies": {
    "@_sh/strapi-plugin-ckeditor": "^2.0.4",
    "@strapi/plugin-graphql": "^4.15.0",
    "@strapi/plugin-i18n": "4.15.0",
    "@strapi/plugin-seo": "^1.9.5",
    "@strapi/plugin-users-permissions": "4.15.0",
    "@strapi/strapi": "4.15.0",
    "mysql": "2.18.1",
    "strapi-plugin-comments": "^2.2.15",
    "strapi-plugin-import-export-entries": "^1.21.1",
    "strapi-plugin-multi-select": "^1.2.2",
    "strapi-plugin-navigation": "^2.2.15",
    "strapi-plugin-reactions": "^1.0.0"
  },
  "author": {
    "name": "A Strapi developer"
  },
  "strapi": {
    "uuid": ""
  },
  "engines": {
    "node": ">=16.0.0 <=20.x.x",
    "npm": ">=6.0.0"
  },
  "license": "MIT",
  "volta": {
    "node": "18.18.0"
  }
}

also my plugins.ts (without relations as it cause error from title)

export default {
  comments: {
    enabled: true,
    config: {
      enabledCollections: ["api::article.article"],
      badWords: true,
      approvalFlow: ["api::article.article"],
      entryLabel: {
        "*": ["Title", "title", "Name", "name", "Subject", "subject"],
      },
      gql: {
        auth: false,
      },
    },
  },
  navigation: { enabled: true },
  seo: {
    enabled: true,
  },
  "import-export-entries": {
    enabled: true,
    config: {
      serverPublicHostname: "http://localhost:1337",
    },
  },
  graphql: {
    config: {
      endpoint: "/graphql",
      shadowCRUD: true,
      playgroundAlways: false,
      depthLimit: 14,
      amountLimit: 100,
      apolloServer: {
        tracing: false,
      },
    },
  },
};

with this added I got mentioned error

reactions: {
    enabled: true,
  },
janlew commented 1 year ago

Also, with plugin installed I'm not able to enter single types edit pages

cyp3rius commented 1 year ago

Issue found but will need more work on as Single Types fails with reactions. ETA 3rd November EOD.

cyp3rius commented 12 months ago

@janlew fix released as part of v1.1.0. Contain breaking changes.

janlew commented 12 months ago

@cyp3rius on version 1.1.1 still gets "Error: Id was already defined and imported as a type, check the docs for extending types" while this is in code (config/plugins.ts):

reactions: {
    enabled: true,
  }

I guess it's needed to make graphql mutations work as I still can't see it in playground.

Here are my dependencies

"dependencies": {
    "@_sh/strapi-plugin-ckeditor": "^2.0.4",
    "@strapi/plugin-graphql": "^4.15.0",
    "@strapi/plugin-i18n": "4.15.0",
    "@strapi/plugin-seo": "^1.9.6",
    "@strapi/plugin-users-permissions": "4.15.0",
    "@strapi/strapi": "^4.15.0",
    "mysql": "2.18.1",
    "strapi-plugin-comments": "^2.2.15",
    "strapi-plugin-import-export-entries": "^1.21.1",
    "strapi-plugin-multi-select": "^1.2.2",
    "strapi-plugin-navigation": "^2.2.16",
    "strapi-plugin-reactions": "^1.1.1"
  },
cyp3rius commented 12 months ago

Got an idea what might be wrong, both Plugins (navigation and reactions) define the Id type for GQL.

Will fix it shortly

cyp3rius commented 11 months ago

Types fixed in v1.1.2. Hope it helps.

janlew commented 11 months ago

@cyp3rius when plugin installed and trying to "npm run dev" I got error:

Module not found: Error: Package path ./admin/src/components/MediaLibraryInput

not sure if it's not Strapi error as I can see that from version 4.15.0 there are many issues with building app but got this error only when strapi-plugin-reactions is installed

cyp3rius commented 11 months ago

Trying to reproduce it. Have you tried on the 4.15.4?

janlew commented 11 months ago

Trying to reproduce it. Have you tried on the 4.15.4?

Yes, I have 4.15.4 installed

 "dependencies": {
    "@_sh/strapi-plugin-ckeditor": "^2.0.4",
    "@strapi/plugin-graphql": "^4.15.4",
    "@strapi/plugin-i18n": "4.15.4",
    "@strapi/plugin-seo": "^1.9.6",
    "@strapi/plugin-users-permissions": "4.15.4",
    "@strapi/strapi": "^4.15.4",
    "mysql": "2.18.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-router-dom": "^5.3.4",
    "strapi-plugin-comments": "^2.2.15",
    "strapi-plugin-import-export-entries": "^1.21.1",
    "strapi-plugin-multi-select": "^1.2.2",
    "strapi-plugin-navigation": "^2.2.16",
    "strapi-plugin-reactions": "^1.1.2",
    "styled-components": "^5.3.11"
  },
cyp3rius commented 11 months ago

I've dropped direct dependency to MediaLibraryInput field as seems not working anymore.

Version v1.1.3 contain the fix.

janlew commented 11 months ago

I've dropped direct dependency to MediaLibraryInput field as seems not working anymore.

Version v1.1.3 contain the fix.

Seems working now at first sight. I'll test it later today and edit this comment with feedback. Thanks for your work!

cyp3rius commented 11 months ago

Looking forward! Reopen the ticket please if issue still persist.