Code Monkey home page Code Monkey logo

baileys-store's People

Contributors

ookamiiixd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

baileys-store's Issues

model.create(Unique constraint failed on the constraint: `PRIMARY` baileys-store

hi, I do individual messaging.
however, after I checked the terminal an error appeared like the following:
image (45)

{"level":50,"time":1674705594919,"pid":183106,"hostname":"casudin-local","err":{"type":"PrismaClientKnownRequestError","message":"\nInvalid model.create()invocation in\n/home/casudin/www/project/wa-api-new/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/home/casudin/www/project/wa-api-new/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 (/home/casudin/www/project/wa-api-new/node_modules/@prisma/client/runtime/index.js:34869:13)\n at RequestHandler.handleAndLogRequestError (/home/casudin/www/project/wa-api-new/node_modules/@prisma/client/runtime/index.js:34841:12)\n at RequestHandler.request (/home/casudin/www/project/wa-api-new/node_modules/@prisma/client/runtime/index.js:34836:12)\n at async PrismaClient._request (/home/casudin/www/project/wa-api-new/node_modules/@prisma/client/runtime/index.js:35926:16)\n at async Promise.all (index 1)\n at async EventEmitter.update (/home/casudin/www/project/wa-api-new/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"}

error while runing npm run build on server

[email protected] build
tsc

src/controllers/chat.ts:16:12 - error TS7006: Parameter 'c' implicitly has an 'any' type.

16 ).map((c) => serializePrisma(c));
~

src/controllers/chat.ts:42:12 - error TS7006: Parameter 'm' implicitly has an 'any' type.

42 ).map((m) => serializePrisma(m));
~

src/controllers/message.ts:19:12 - error TS7006: Parameter 'm' implicitly has an 'any' type.

19 ).map((m) => serializePrisma(m));
~

Found 3 errors in 2 files.

Errors Files
2 src/controllers/chat.ts:16
1 src/controllers/message.ts:19

An error accored during group participants update

{
    "level": 50,
    "time": 1678108145766,
    "pid": 1619577,
    "hostname": "host",
    "err": {
        "type": "TypeError",
        "message": "Cannot read properties of undefined (reading 'push')",
        "stack": "TypeError: Cannot read properties of undefined (reading 'push')\n    at EventEmitter.updateParticipant (/home/whatsapp/whatsapp/node_modules/@ookamiiixd/baileys-store/dist/handlers/group-metadata.js:55:43)"
    },
    "msg": "An error occured during group participants update"
}

An error occured during contact update

Library fails to update contact when baileys sends contacts.update with contact that doesn't exist in database.

{
    "level": 50,
    "time": 1678092911539,
    "pid": 1610218,
    "hostname": "host",
    "err": {
        "type": "PrismaClientKnownRequestError",
        "message": "\nInvalid `model.update()` invocation in\n/home/whatsapp/new/node_modules/@ookamiiixd/baileys-store/dist/handlers/contact.js:57:29\n\n  54 const update = async (updates) => {\n  55     for (const update of updates) {\n  56         try {\n\u2192 57             await model.update(\nAn operation failed because it depends on one or more records that were required but not found. Record to update not found.",
        "stack": "Error: \nInvalid `model.update()` invocation in\n/home/whatsapp/new/node_modules/@ookamiiixd/baileys-store/dist/handlers/contact.js:57:29\n\n  54 const update = async (updates) => {\n  55     for (const update of updates) {\n  56         try {\n\u2192 57             await model.update(\nAn operation failed because it depends on one or more records that were required but not found. Record to update not found.\n    at Zr.handleRequestError (/home/whatsapp/new/node_modules/@prisma/client/runtime/library.js:171:6414)\n    at Zr.handleAndLogRequestError (/home/whatsapp/new/node_modules/@prisma/client/runtime/library.js:171:5948)\n    at Zr.request (/home/whatsapp/new/node_modules/@prisma/client/runtime/library.js:171:5786)\n    at async t._request (/home/whatsapp/new/node_modules/@prisma/client/runtime/library.js:174:10455)\n    at async EventEmitter.update (/home/whatsapp/new/node_modules/@ookamiiixd/baileys-store/dist/handlers/contact.js:57:17)",
        "code": "P2025",
        "clientVersion": "4.11.0",
        "meta": {
            "cause": "Record to update not found."
        }
    },
    "msg": "An error occured during contact update"
}

Prisma fails to run migration on postgresql

Steps to reproduce:

git clone [email protected]:ookamiiixd/baileys-store.git
cd baileys-store
docker run --rm --name wapostgres -p 5444:5432 -e POSTGRES_PASSWORD=1234 -d postgres
npm i
echo 'DATABASE_URL="postgresql://postgres:1234@localhost:5444/wa"' > .env
sed -i 's/mysql/postgresql/g' prisma/schema.prisma
npx prisma migrate dev

Output from prisma:

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "wa", schema "public" at "localhost:5444"

Error: Prisma schema validation - (query-engine-node-api library)
Error code: P1012
error: Error parsing attribute "@@unique": The given constraint name `unique_id_per_session_id` has to be unique in the following namespace: global for primary key, indexes and unique constraints. Please provide a different name using the `map` argument.
  -->  schema.prisma:60
   |
59 |
60 |   @@unique([sessionId, id], map: "unique_id_per_session_id")
   |
error: Error parsing attribute "@@unique": The given constraint name `unique_id_per_session_id` has to be unique in the following namespace: global for primary key, indexes and unique constraints. Please provide a different name using the `map` argument.
  -->  schema.prisma:74
   |
73 |
74 |   @@unique([sessionId, id], map: "unique_id_per_session_id")
   |
error: Error parsing attribute "@@unique": The given constraint name `unique_id_per_session_id` has to be unique in the following namespace: global for primary key, indexes and unique constraints. Please provide a different name using the `map` argument.
  -->  schema.prisma:97
   |
96 |
97 |   @@unique([sessionId, id], map: "unique_id_per_session_id")
   |
error: Error parsing attribute "@@unique": The given constraint name `unique_id_per_session_id` has to be unique in the following namespace: global for primary key, indexes and unique constraints. Please provide a different name using the `map` argument.
  -->  schema.prisma:160
   |
159 |
160 |   @@unique([sessionId, id], map: "unique_id_per_session_id")
   |

Validation Error Count: 4
[Context: getDmmf]

Prisma CLI Version : 4.7.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.