Concurrency issue with two nodes Postgres cluster

System Information
  • Strapi Version: 4.12.6
  • Operating System:
  • Database: Postgres
  • Node Version: 16.15.1
  • NPM Version: 8.11.0
  • Yarn Version:

Hello,

I’ve got a problem with my Production Strapi. I have to synchronize a list of projects from my client API (several hundred of objects) into a Strapi collection.

Each project have to be stored in three locales resulting in a lots of calls to Strapi for deleting, updating or creating collection entries depending on my clients projects list.

The Strapi instance is connected to a two nodes Postgres SQL cluster.

Once the sychronisation is running, some entries cannot be created as I get a Strapi error

Cannot read properties of null (reading 'id')
TypeError: Cannot read properties of null (reading 'id')
    at createComponents (/opt/node_modules/@strapi/strapi/lib/services/entity-service/components.js:67:25)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.create (/opt/node_modules/@strapi/strapi/lib/services/entity-service/index.js:162:27)
    at async Object.<anonymous> (/opt/node_modules/@strapi/strapi/lib/services/entity-service/index.js:416:20)
    at async Object.create (/opt/node_modules/@strapi/plugin-i18n/server/services/entity-service-decorator.js:130:19)
    at async Object.create (/opt/node_modules/@strapi/strapi/lib/core-api/controller/collection-type.js:63:22)
    at async returnBodyMiddleware (/opt/node_modules/@strapi/strapi/lib/services/server/compose-endpoint.js:52:18)
    at async policiesMiddleware (/opt/node_modules/@strapi/strapi/lib/services/server/policy.js:24:5)
    at async /opt/node_modules/@strapi/strapi/lib/middlewares/body.js:58:9
    at async /opt/node_modules/@strapi/strapi/lib/middlewares/logger.js:9:5
    at async /opt/node_modules/@strapi/strapi/lib/middlewares/powered-by.js:16:5
    at async cors (/opt/node_modules/@koa/cors/index.js:61:32)
    at async /opt/node_modules/@strapi/strapi/lib/middlewares/errors.js:13:7
    at async session (/opt/node_modules/koa-session/index.js:41:7)
    at async /opt/node_modules/@strapi/strapi/lib/services/metrics/middleware.js:29:5

None of these error occurs if I delay two projects synchronisations by 5 seconds or if I remove one of the two nodes of the Postgres cluster.

Is it possible that I run into a concurrency error or something like that during my projects synchronisation ?

Thank by advance for the help, regards,
Théo.