System Information
- Strapi Version: v4.2.0
- Operating System: Windows
I’m migrating my strapi from v3 to v4 and I got this problem
TypeError: Cannot read properties of undefined (reading 'forEach')
at D:\Documents\Job\testStrapiV4\my-project\node_modules\@strapi\strapi\lib\services\server\register-routes.js:98:21
at D:\Documents\Job\testStrapiV4\my-project\node_modules\lodash\lodash.js:4967:15
at baseForOwn (D:\Documents\Job\testStrapiV4\my-project\node_modules\lodash\lodash.js:3032:24)
at D:\Documents\Job\testStrapiV4\my-project\node_modules\lodash\lodash.js:4936:18
at Function.forEach (D:\Documents\Job\testStrapiV4\my-project\node_modules\lodash\lodash.js:9410:14)
at registerAPIRoutes (D:\Documents\Job\testStrapiV4\my-project\node_modules\@strapi\strapi\lib\services\server\register-routes.js:94:7)
at module.exports (D:\Documents\Job\testStrapiV4\my-project\node_modules\@strapi\strapi\lib\services\server\register-routes.js:25:3)
at Object.initRouting (D:\Documents\Job\testStrapiV4\my-project\node_modules\@strapi\strapi\lib\services\server\index.js:93:13)
at Strapi.bootstrap (D:\Documents\Job\testStrapiV4\my-project\node_modules\@strapi\strapi\lib\Strapi.js:415:23)
at async Strapi.load (D:\Documents\Job\testStrapiV4\my-project\node_modules\@strapi\strapi\lib\Strapi.js:426:5)
I did update the controllers and the services. I did try to delete node_modules and JSON lock file and then run the npm install again, sadly it didn’t work.
Here is my controllers:
const { createCoreController } = require('@strapi/strapi').factories;
module.exports = createCoreController('api::group.group');
Here is my routes:
const { createCoreRouter } = require('@strapi/strapi').factories;
module.exports = createCoreRouter('api::group.group');
Here is my service:
const { createCoreService } = require('@strapi/strapi').factories;
module.exports = createCoreService('api::group.group');
Here is my content-type:
{
"kind": "collectionType",
"collectionName": "group",
"info": {
"singularName": "group",
"pluralName": "groups",
"displayName": "Group",
"name": "Group"
},
"options": {
"increments": true,
"timestamps": true
},
"attributes": {
"project": {
"type": "relation",
"relation": "manyToOne",
"target": "api::project.project",
"inversedBy": "groups"
},
"users": {
"type": "relation",
"relation": "manyToMany",
"target": "plugin::users-permissions.user",
"inversedBy": "groups"
},
"name": {
"type": "string",
"required": true
},
"categories": {
"type": "relation",
"relation": "manyToMany",
"target": "api::category.category",
"inversedBy": "groups"
},
"meetings": {
"type": "relation",
"relation": "manyToMany",
"target": "api::meeting.meeting",
"mappedBy": "groups"
},
"googledocouidshared": {
"type": "string"
},
"googledocouid": {
"type": "string"
},
"documents": {
"type": "relation",
"relation": "oneToMany",
"target": "api::googledocument.googledocument",
"mappedBy": "group"
}
}
}