Cannot set up route/controller for singleType

I am attempting to create a singleType collection for plugin settings as I can’t get the settings page to work. I’ve used yarn strapi generate

I’m getting this error, which indicates that the setting contentType is not being imported properly and therefore doesnt know what singleType means afaik
TypeError: Error creating endpoint GET /notifications/setting: Cannot ││ read properties of undefined (reading 'find')

this is the schema for the settings, its imported and exported by a index.js. I’ve also imported all the routes and controllers correctly in the same way I have for other collectionType collections.

{
  "kind": "singleType",
  "collectionName": "settings",
  "info": {
    "singularName": "setting",
    "pluralName": "settings",
    "displayName": "Settings"
  },
  "options": {
    "draftAndPublish": false,
    "comment": ""
  },
  "attributes": {}
}

content-types/index.js


module.exports = {
  "notification": require('./notification'),
  "pushkey": require('./pushkey'),
  "setting": require('./setting'),

};```

routes/index.js
```  'admin': {
    routes: [
      // ...notificationsSettings.routes,
      {
        method: 'GET',
        path: '/notifications/setting',
        handler: 'setting.find',
        config: {
          policies: [],
          middlewares: [],
          prefix: "",
        },
      },```
controllers/settings.js
```'use strict';

/**
 *  controller
 */

const { createCoreController } = require('@strapi/strapi').factories;

module.exports = createCoreController('plugin::notifications-morph.setting');

which is imported into controllers/index.js like this


const notification = require('./notification');
const notifications = require('./notifications');
const setting = require('./setting');

const pushkey = require('./pushkey');

module.exports = {
  notification,
  notifications,
  setting,
  pushkey,

};

This topic has been created from a Discord post (1288907882552758283) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

Note to any that stumble across this: I was able to solve this by manually setting the route handlers. Not sure what the underlying issue is, but this gets it to compile

      method: 'GET',
      path: '/notifications/setting',
      handler: async (ctx) => {
        return strapi.controllers['notifications-setting'].find(ctx);
      },
      config: {
        policies: [],
        middlewares: [],
        prefix: "",
      },
    },
    {
      method: 'GET',
      path: '/notifications/setting/:id',
      handler: async (ctx) => {
        return strapi.controllers['notifications-setting'].findOne(ctx);
      },
      config: {
        policies: [],
        middlewares: [],
        prefix: "",
      },
    },
    {
      method: 'POST',
      path: '/notifications/setting',
      handler: async (ctx) => {
        return strapi.controllers['notifications-setting'].update(ctx);
      },
      config: {
        policies: [],
        middlewares: [],
        prefix: "",
      },
    },
    {
      method: 'PUT',
      path: '/notifications/setting/:id',
      handler: async (ctx) => {
        return strapi.controllers['notifications-setting'].create(ctx);
      },
      config: {
        policies: [],
        middlewares: [],
        prefix: "",
      },
    },
    {
      method: 'DELETE',
      path: '/notifications/setting/:id',
      handler: async (ctx) => {
        return strapi.controllers['notifications-setting'].delete(ctx);
      },
      config: {
        policies: [],
        middlewares: [],
        prefix: "",
      },
    },```