Getting "Cannot read properties of undefined" when registering a new custom controller

I have essentially created some boilerplate code for a custom controller for an endpoint path as ‘email/newsletter/submit’ which will receive email data through POST requests.

I am getting this error on the console when I try to debug:

[2024-02-25 21:46:29.637] debug: ⛔️ Server wasn't able to
start properly.
[2024-02-25 21:46:29.639] error: Error creating endpoint
POST email/newsletter/submit: Cannot read properties of u
ndefined (reading 'kind')
TypeError: Error creating endpoint POST email/newsletter/
submit: Cannot read properties of undefined (reading 'kin

These are my files for context:


module.exports = {
  routes: [
      method: "POST",
      path: "email/newsletter/submit",
      handler: "newsletter.send",
      config: {
        auth: false,



"use strict";

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

module.exports = createCoreController("", ({ strapi }) => ({
  async send(ctx) {
    const sanitizedQueryParams = await this.sanitizeQuery(ctx);

    const { slugParams } = ctx.params;

    response = {};

    ctx.body = response;

I do not have any content-type created for this. This is just something I created by creating these files. I did not use the interactive generation tool.

I have been looking into this for some time now today, what could I be doing wrong here?

System Information
  • Strapi Version: 4.11.1
  • Operating System: Ubuntu 22
  • Database: MYSQL
  • Node Version: 18.19.0
  • NPM Version: 10.2.3
  • Yarn Version: 1.22.19