TypeError: Cannot read properties of undefined (reading 'kind')

Hi team!
I created a custom controller Following THIS GUIDE.

I placed it on ./src/api/[api-name]/controllers/ with the name twitter.js (I’m trying to tweet from strapi :slight_smile:

When I run

npm run develop

The received output is the next:

[2022-05-21 22:50:45.296] debug: ⛔️ Server wasn't able to start properly.
[2022-05-21 22:50:45.297] error: Cannot read properties of undefined (reading 'kind')
TypeError: Cannot read properties of undefined (reading 'kind')
    at Object.isSingleType (/home/martinlarizzate/Documents/Projects/mauka/node_modules/@strapi/utils/lib/content-types.js:90:25)
    at createController (/home/martinlarizzate/Documents/Projects/mauka/node_modules/@strapi/strapi/lib/core-api/controller/index.js:36:20)
    at /home/martinlarizzate/Documents/Projects/mauka/node_modules/@strapi/strapi/lib/factories.js:11:28
    at Object.get (/home/martinlarizzate/Documents/Projects/mauka/node_modules/@strapi/strapi/lib/core/registries/controllers.js:37:61)
    at Object.get [as api::mauka.twitter] (/home/martinlarizzate/Documents/Projects/mauka/node_modules/@strapi/strapi/lib/core/registries/controllers.js:55:25)
    at /home/martinlarizzate/Documents/Projects/mauka/node_modules/lodash/lodash.js:4967:32
    at baseForOwn (/home/martinlarizzate/Documents/Projects/mauka/node_modules/lodash/lodash.js:3032:24)
    at Function.mapKeys (/home/martinlarizzate/Documents/Projects/mauka/node_modules/lodash/lodash.js:13430:7)
    at removeNamespacedKeys (/home/martinlarizzate/Documents/Projects/mauka/node_modules/@strapi/strapi/lib/core/domain/module/index.js:11:12)
    at Object.get controllers [as controllers] (/home/martinlarizzate/Documents/Projects/mauka/node_modules/@strapi/strapi/lib/core/domain/module/index.js:103:14)
    at /home/martinlarizzate/Documents/Projects/mauka/node_modules/@strapi/plugin-users-permissions/server/services/users-permissions.js:155:28
    at /home/martinlarizzate/Documents/Projects/mauka/node_modules/lodash/lodash.js:3585:27
    at /home/martinlarizzate/Documents/Projects/mauka/node_modules/lodash/lodash.js:4967:15
    at baseForOwn (/home/martinlarizzate/Documents/Projects/mauka/node_modules/lodash/lodash.js:3032:24)
    at /home/martinlarizzate/Documents/Projects/mauka/node_modules/lodash/lodash.js:4936:18
    at baseMap (/home/martinlarizzate/Documents/Projects/mauka/node_modules/lodash/lodash.js:3584:7)

I removed node_modules, all lock files and reinstalled but did not solve the issue.
In other cuestion, one guy mentions that this issue is related to ampy collection types folder but I think it’s not my case.

Any Ideas?

Hello, did you migrate models to content-types?

I had the same issue when upgrading to Strapi 4. I had to remove both .cache and build, then run strapi develop. Be sure to backup .tmp/data.db if you are performing an upgrade.