YupValidationError: Invalid relations - On innsert via entity Service

System Information
  • Strapi Version: v4.15.2
  • Operating System: MacOs Ventura 13.0.1
  • Database: Sequliite
  • Node Version: v18.15.0
  • NPM Version: 9.5.0
  • Yarn Version: 1.22.19

I have a entity called Terminals ,


There are no relations here. I also have a custom api called Iclock
When i try to insert record in the entiry, i am getting error

YupValidationError: Invalid relations

Below is the code

terminal = await strapi.entityService.create("api::terminal:terminal", {
        data: {
          serial: serialNumber,
          model: "test",
          location: "Boutique",
          // added: fns.format(new Date(), "dd-MM-yyyy hh:mm:ss"),
          opStamp: Date.now().toString(),
        },
      });

The error i get is also not too descriptive

/Users/shreyasubale/projects/sil-backend-strapi/node_modules/@strapi/utils/dist/index.js:408
  throw new YupValidationError(error, errorMessage);
        ^

YupValidationError: Invalid relations
    at handleYupError (/Users/shreyasubale/projects/sil-backend-strapi/node_modules/@strapi/utils/dist/index.js:408:9)
    at /Users/shreyasubale/projects/sil-backend-strapi/node_modules/@strapi/utils/dist/index.js:418:7
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.create (/Users/shreyasubale/projects/sil-backend-strapi/node_modules/@strapi/strapi/dist/services/entity-service/index.js:122:23)
    at async Object.<anonymous> (/Users/shreyasubale/projects/sil-backend-strapi/node_modules/@strapi/strapi/dist/services/entity-service/index.js:309:18)
    at async Object.getOrAddTerminal (/Users/shreyasubale/projects/sil-backend-strapi/src/api/iclock/services/iclock.js:30:18) {
  details: {
    errors: [
      {
        path: [],
        message: 'Invalid relations',
        name: 'ValidationError'
      }
    ]
  }
}```

Any pointers will be highly appreciated.
Thanks !

facing the same issue, did you find any fix for it?

I’m also facing the same error while creating tables.

same issue here on RHEL8

OK i’m guessing others like me were packaging their nodejs applications and deploying them on a QA or PROD server.

What happened to me here was I had a corrupted copy which was missing package-lock.json and maybe a few other files. Fixing this packaging issue and tarring up my entire strapi folder turned out to fix the issue.