Strapi migration problem

System Information
  • Strapi Version: 4.1.7
  • Operating System: mac
  • Database: MariaDB
  • Node Version: 14.17.3
  • NPM Version: 6.14.13
  • Yarn Version:

Hello,
I am trying to migrate a project from strapi 3 to the lastest version.
I have used codemods (GitHub - strapi/codemods: A set of scripts to help migrate Strapi plugins (and in some cases Strapi applications) from v3 to v4) to migrate components, dependencies and plugins.
When I restart the server, I have the error:

error: Cannot read property ‘forEach’ of undefined
TypeError: Cannot read property ‘forEach’ of undefined
at /Volumes/Workspace/strapi-tech/node_modules/@strapi/strapi/lib/services/server/register-routes.js:98:21
at /Volumes/Workspace/strapi-tech/node_modules/lodash/lodash.js:4967:15
at baseForOwn (/Volumes/Workspace/strapi-tech/node_modules/lodash/lodash.js:3032:24)
at /Volumes/Workspace/strapi-tech/node_modules/lodash/lodash.js:4936:18
at Function.forEach (/Volumes/Workspace/strapi-tech/node_modules/lodash/lodash.js:9410:14)
at registerAPIRoutes (/Volumes/Workspace/strapi-tech/node_modules/@strapi/strapi/lib/services/server/register-routes.js:94:7)
at module.exports (/Volumes/Workspace/strapi-tech/node_modules/@strapi/strapi/lib/services/server/register-routes.js:25:3)
at Object.initRouting (/Volumes/Workspace/strapi-tech/node_modules/@strapi/strapi/lib/services/server/index.js:93:13)
at Strapi.bootstrap (/Volumes/Workspace/strapi-tech/node_modules/@strapi/strapi/lib/Strapi.js:404:23)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Strapi.load (/Volumes/Workspace/strapi-tech/node_modules/@strapi/strapi/lib/Strapi.js:415:5)
at async Strapi.start (/Volumes/Workspace/strapi-tech/node_modules/@strapi/strapi/lib/Strapi.js:163:9)

What could be wrong?

Thank you!

Did anyone resolve this issue? I have the same one, I did update the controllers and services. I did try to delete node_modules and json lock file and than run the npm install, 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"
    }
  }
}