Strapi Update Error: Cannot read properties of undefined (reading 'findViewConfiguration')

System Information
  • Strapi Version: 4.9.1
  • Operating System: Windows 11
  • Database: Postgres
  • Node Version: 18.13.0
  • NPM Version: 8.19.3
  • Yarn Version: 1.22.19

Hi there - I’m trying to upgrade our projects Strapi version from 4.5.3 to 4.9.1. There is sadly one Error that I just cannot seem to resolve. yarn build works fine, but as soon as I try to start it (yarn develop), this error appears:

[2023-04-18 09:37:54.536] debug: ⛔️ Server wasn't able to start properly.
[2023-04-18 09:37:54.537] error: Error creating endpoint GET /configuration: Cannot read properties of undefined (reading 'findViewConfiguration')

TypeError: Error creating endpoint GET /configuration: Cannot read properties of undefined (reading 'findViewConfiguration')
    at getAction (D:\Projects\HeadlessCMS\strapi\node_modules\@strapi\strapi\lib\services\server\compose-endpoint.js:130:24)
    at D:\Projects\HeadlessCMS\strapi\node_modules\@strapi\strapi\lib\services\server\compose-endpoint.js:71:22
    at createRoute (D:\Projects\HeadlessCMS\strapi\node_modules\@strapi\strapi\lib\services\server\routing.js:79:5)
    at D:\Projects\HeadlessCMS\strapi\node_modules\@strapi\strapi\lib\services\server\routing.js:90:9
    at Array.forEach (<anonymous>)
    at Object.addRoutes (D:\Projects\HeadlessCMS\strapi\node_modules\@strapi\strapi\lib\services\server\routing.js:88:21)
    at Object.routes (D:\Projects\HeadlessCMS\strapi\node_modules\@strapi\strapi\lib\services\server\api.js:25:20)
    at Object.routes (D:\Projects\HeadlessCMS\strapi\node_modules\@strapi\strapi\lib\services\server\index.js:78:27)
    at D:\Projects\HeadlessCMS\strapi\node_modules\@strapi\strapi\lib\services\server\register-routes.js:78:23
    at D:\Projects\HeadlessCMS\strapi\node_modules\lodash\lodash.js:4967:15

The problem is, I can’t seem to even find a trace of “findViewConfiguration” on the whole internet. It doesn’t appear in the listed files either and my global search doesn’t find it. For example the mentioned line compose-endpoint.js:130 is just a seemingly random if statement:

if (typeof controller[actionName] !== 'function') { // <-- line 130
    throw new Error(`Handler not found "${handler}"`);
  }

So I don’t even know where to start fixing this error. Can anyone help me with this? This is my package.json:

{
  "name": "headless_cms",
  "private": true,
  "version": "0.1.0",
  "description": "A Strapi application",
  "scripts": {
    "develop": "strapi develop",
    "start": "strapi start",
    "build": "strapi build",
    "strapi": "strapi"
  },
  "dependencies": {
    "@strapi/plugin-i18n": "^4.9.1",
    "@strapi/strapi": "^4.9.1",
    "@strapi/utils": "^4.9.1",
    "jwt-decode": "^3.1.2",
    "pg": "8.6.0",
    "strapi-plugin-duplicate-button": "^1.1.7",
    "strapi-plugin-meilisearch": "0.8.0"
  },
  "author": {
    "name": "A Strapi developer"
  },
  "strapi": {
    "telemetryDisabled": true,
    "uuid": "5ef568f8-509b-463e-9249-6746d4b4de82"
  },
  "engines": {
    "node": ">=12.x.x <=18.x.x",
    "npm": ">=6.0.0"
  },
}

Any help with this would be greatly appreciated.

Can you try to clone the strapi instance and remove both the strapi-plugin-duplicate-button and strapi-plugin-meilisearch please don’t do this in the live env since all data the plugins will have saved would be gone

Thanks for the answer - it was a completely different error after all that was related to our custom modifications to some plugins. This specific error occured because our customizations of the upload plugin didn’t require the module “viewConfiguration”. So in the index.js these lines were missing:

const viewConfiguration = require("@strapi/plugin-upload/server/controllers/view-configuration");
module.exports = {
...
  "view-configuration": viewConfiguration,
};
`