createCoreController Fails in Plugin

System Information
  • Strapi Version:
  • Operating System:
    Linux Manjaro
  • Database:
  • Node Version:
  • NPM Version:

Hi there!

I’m struggling creating a core router for a content-type created in a strapi plugin. I did the following (according to the docs):

// src/plugins/pluginname/server/controllers/foo.js
const { createCoreController } = require("@strapi/strapi").factories;

module.exports = createCoreController("", ({ strapi }) =>  ({
  async find(ctx) {
    // This is called
    console.log('find() called');
    // This fails
    const { data, meta } = await super.find(ctx);
    return { data, meta };
module.exports = {
  type: 'admin',
  routes: [
      method: 'GET',
      path: '/plugin/foo/find',
      handler: 'foo.find',
      config: {
        policies: [],
        auth: false,
        prefix: ""

When I’m calling the http://localhost:1337/plugin/foo/find route, the console logs the message. However the super call fails. I’m quite sure that I’m calling the correct content-type (, since when I change this to e.g. the server won’t even start.

Help is really very much wanted - thank you a lot! :slight_smile:

PS: I also can’t create a createCoreRoutes, this causes the server to shutdown, prompting “cannot read properties of undefined (reading ‘kind’)”.

Plugins don’t suport createCore you would have to do it in the old way see any of strapis plugins as an example

Thanks you for your response! Do you by chance have a suggestion, which plugin to look at? Would be very helpful! :slight_smile:

I would look at the plugins in strapis mono repo

1 Like