According to the documentation, badRequest is the right way to go. So problem must be related to the way I have configured the controller.
I have not been able to reproduce exactly what I’ve been doing wrong. But I believe that this has been the problem.
** api/lorem/controllers.lorem.ts** (old)
module.exports = factories.createCoreController('api::lorem.lorem', ({
strapi
}) => ({
async create(ctx) {
(...)
}
})
** api/lorem/controllers.lorem.ts** (new)
const create = async (ctx) {
(...)
}
export default {
create
}
So in short, the error message was not really helpful. Running strapi generate was useful in this scenario, cause it gave me an outline of how a controller should be exported. No idea why it worked in my previous project, but than again. This kind of code inconsistency of mine is the sole reason I wanted to start a fresh and new project ![]()