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

TypeError: Cannot read properties of undefined (reading 'kind') when trying to create a new content type from dashboard or command line. #20127

Open
palashCItobuz opened this issue Apr 16, 2024 · 1 comment
Assignees
Labels
issue: bug Issue reporting a bug severity: medium If it breaks the basic use of the product but can be worked around source: core:content-type-builder Source is core/content-type-builder package status: pending reproduction Waiting for free time to reproduce the issue, or more information

Comments

@palashCItobuz
Copy link

Bug report

Required System information

  • Node.js version: 20.11
  • NPM version: 10.2.4
  • Strapi version: 4.20
  • Database: postgres
  • Operating system: IOS
  • Is your project Javascript or Typescript: Typescript

Describe the bug

A clear and concise description of what the bug is.

Steps to reproduce the behavior

  1. Go to 'Content-Type Builder'
  2. Click on 'Create new collection type'
  3. Create new collection type
  4. See error

Expected behavior

A new content type created with it's associated files in the api folder, entry in the database and types in the contentTypes.d.ts file.

Error shows instead:

┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ │
│ TypeError: Cannot read properties of undefined (reading 'kind') │
│ at Module.isSingleType (/Users/itobuz/Development/testtrou/node_modules/@strapi/utils/dist/index.js:771:25) │
│ at Module.createRoutes (/Users/itobuz/Development/testtrou/node_modules/@strapi/strapi/dist/core-api/routes/index.js:5:32) │
│ at get routes [as routes] (/Users/itobuz/Development/testtrou/node_modules/@strapi/strapi/dist/factories.js:63:39) │
│ at /Users/itobuz/Development/testtrou/node_modules/@strapi/strapi/dist/services/server/register-routes.js:67:14 │
│ at /Users/itobuz/Development/testtrou/node_modules/lodash/lodash.js:4967:15 │
│ at baseForOwn (/Users/itobuz/Development/testtrou/node_modules/lodash/lodash.js:3032:24) │
│ at /Users/itobuz/Development/testtrou/node_modules/lodash/lodash.js:4936:18 │
│ at Function.forEach (/Users/itobuz/Development/testtrou/node_modules/lodash/lodash.js:9410:14) │
│ at registerAPIRoutes (/Users/itobuz/Development/testtrou/node_modules/@strapi/strapi/dist/services/server/register-routes.js:65:24) │
│ at registerAllRoutes (/Users/itobuz/Development/testtrou/node_modules/@strapi/strapi/dist/services/server/register-routes.js:19:3) │
│ │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

@palashCItobuz
Copy link
Author

Hi, I was able to figure out the issue. The issue for me was due to "resolveJsonModule": false in tsconfig.json file. Once I enabled it and rebuilt everything the issue was resolved. So leaving the message here as it might be helpful for others facing similar issue.

@joshuaellis joshuaellis added issue: bug Issue reporting a bug severity: medium If it breaks the basic use of the product but can be worked around source: core:content-type-builder Source is core/content-type-builder package status: pending reproduction Waiting for free time to reproduce the issue, or more information labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Issue reporting a bug severity: medium If it breaks the basic use of the product but can be worked around source: core:content-type-builder Source is core/content-type-builder package status: pending reproduction Waiting for free time to reproduce the issue, or more information
Projects
Status: To be reviewed (Open)
Status: To review
Development

No branches or pull requests

3 participants