Need help overriding the Restaurant service.js (my override is not used)

System Information
  • strapi 3.6.2
  • Linux:
  • PostgresQL:
  • Node 12:
  • NPM 6.14.10:
  • Yarn 1.22.5:

Hi, I’m unable to get customization of service.js to work, can someone help?

Steps:

  1. git clone git@github.com:strapi/strapi.git
  2. cd strapi/examples/getstarted
  3. nano api/restaurant/services/Restaurant.js
  4. replace the file with following contents:
module.exports = {
    async create(data, { files } = {}) {
        console.log("Create restaurant --> now crash");
        throw new Error("Crash");
    },
};
  1. run yarn develop
  2. add a restaurant in the admin console

I expected to see the console message and then some kind of error, without any restaurant being added. Instead, it does add the restaurant without showing any errors.

The answer: when creating an entity in the admin, the service and controller are not used.