Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
janlew opened this issue Oct 28, 2023 · 14 comments
Assignees
Labels
bug Something isn't working solved Issue solved

Comments

@janlew
Copy link

janlew commented Oct 28, 2023

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
Copy link
Contributor

cyp3rius commented Oct 28, 2023

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

@janlew
Copy link
Author

janlew commented Oct 28, 2023

@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
Copy link
Author

janlew commented Nov 1, 2023

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

@cyp3rius cyp3rius self-assigned this Nov 1, 2023
@cyp3rius cyp3rius added bug Something isn't working in progress Implementation in progress labels Nov 1, 2023
@cyp3rius
Copy link
Contributor

cyp3rius commented Nov 1, 2023

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

@cyp3rius
Copy link
Contributor

cyp3rius commented Nov 3, 2023

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

@cyp3rius cyp3rius added solved Issue solved and removed in progress Implementation in progress labels Nov 3, 2023
@cyp3rius cyp3rius closed this as completed Nov 3, 2023
@janlew
Copy link
Author

janlew commented Nov 6, 2023

@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
Copy link
Contributor

cyp3rius commented Nov 6, 2023

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

Will fix it shortly

@cyp3rius cyp3rius reopened this Nov 6, 2023
@cyp3rius
Copy link
Contributor

Types fixed in v1.1.2. Hope it helps.

@janlew
Copy link
Author

janlew commented Nov 15, 2023

@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
Copy link
Contributor

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

@janlew
Copy link
Author

janlew commented Nov 16, 2023

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
Copy link
Contributor

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

Version v1.1.3 contain the fix.

@janlew
Copy link
Author

janlew commented Nov 16, 2023

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working solved Issue solved
Projects
None yet
Development

No branches or pull requests

2 participants