ookamiiixd / baileys-api

Simple WhatsApp REST API with multiple device support
MIT License
431 stars 327 forks source link

model.create(Unique constraint failed on the constraint: PRIMARY #154

Open hung101 opened 1 year ago

hung101 commented 1 year ago

I facing some messages does not store into database which get the error from the logs as following:

image

{"level":50,"time":1677119196345,"pid":14721,"hostname":"Edwards-MacBook-Pro.local","err":{"type":"PrismaClientKnownRequestError","message":"\nInvalid model.create() invocation in\n/Users/edwardtan/Sites/localhost/whatsapp/whatsapp_service/node_modules/@ookamiiixd/baileys-store/dist/handlers/message.js:79:27\n\n 76 },\n 77 },\n 78 }),\n→ 79 model.create(\nUnique constraint failed on the constraint: PRIMARY","stack":"Error: \nInvalid model.create() invocation in\n/Users/edwardtan/Sites/localhost/whatsapp/whatsapp_service/node_modules/@ookamiiixd/baileys-store/dist/handlers/message.js:79:27\n\n 76 },\n 77 },\n 78 }),\n→ 79 model.create(\nUnique constraint failed on the constraint: PRIMARY\n at RequestHandler.handleRequestError (/Users/edwardtan/Sites/localhost/whatsapp/whatsapp_service/node_modules/@prisma/client/runtime/index.js:34869:13)\n at RequestHandler.handleAndLogRequestError (/Users/edwardtan/Sites/localhost/whatsapp/whatsapp_service/node_modules/@prisma/client/runtime/index.js:34841:12)\n at RequestHandler.request (/Users/edwardtan/Sites/localhost/whatsapp/whatsapp_service/node_modules/@prisma/client/runtime/index.js:34836:12)\n at async PrismaClient._request (/Users/edwardtan/Sites/localhost/whatsapp/whatsapp_service/node_modules/@prisma/client/runtime/index.js:35926:16)\n at async Promise.all (index 1)\n at async EventEmitter.update (/Users/edwardtan/Sites/localhost/whatsapp/whatsapp_service/node_modules/@ookamiiixd/baileys-store/dist/handlers/message.js:68:17)","code":"P2002","clientVersion":"4.7.1","meta":{"target":"PRIMARY"}},"msg":"An error occured during message update edward"}

ookamiiixd commented 1 year ago

Yes, the store is not stable yet. I'll investigate more to see if there's any solution for this

hung101 commented 1 year ago

Yes, the store is not stable yet. I'll investigate more to see if there's any solution for this

thank you really appreciate. will wait for the update :)