ookamiiixd / baileys-api

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

Unable to create session {{BASE_URL}}/sessions/add #141

Closed rsaisankalp closed 1 year ago

rsaisankalp commented 1 year ago

Followed all the steps and primsma migration is also successful. tried with nodejs versions 16 and 19 also. tried multiple times as well . no difference .

error logs:

Server is listening on http://localhost:3000 {"level":50,"time":1675673775179,"pid":26620,"hostname":"MacBook-Air.local","err":{"type":"NotFoundError","message":"No Session found","stack":"NotFoundError: No Session found\n at /Users/apple/code/nodejs/trial/baileys-api/node_modules/@prisma/client/runtime/index.js:34062:15\n at async /Users/apple/code/nodejs/trial/baileys-api/node_modules/@prisma/client/runtime/index.js:34060:20\n at async read (/Users/apple/code/nodejs/trial/baileys-api/node_modules/@ookamiiixd/baileys-store/dist/session.js:28:30)\n at async useSession (/Users/apple/code/nodejs/trial/baileys-api/node_modules/@ookamiiixd/baileys-store/dist/session.js:50:20)\n at async createSession (/Users/apple/code/nodejs/trial/baileys-api/dist/wa.js:141:34)","code":"P2025","clientVersion":"4.7.1","name":"NotFoundError"},"msg":"An error occured during session read"} {"level":50,"time":1675673780405,"pid":26620,"hostname":"MacBook-Air.local","err":{"type":"NotFoundError","message":"No Session found","stack":"NotFoundError: No Session found\n at /Users/apple/code/nodejs/trial/baileys-api/node_modules/@prisma/client/runtime/index.js:34062:15\n at async /Users/apple/code/nodejs/trial/baileys-api/node_modules/@prisma/client/runtime/index.js:34060:20\n at async read (/Users/apple/code/nodejs/trial/baileys-api/node_modules/@ookamiiixd/baileys-store/dist/session.js:28:30)\n at async useSession (/Users/apple/code/nodejs/trial/baileys-api/node_modules/@ookamiiixd/baileys-store/dist/session.js:50:20)\n at async createSession (/Users/apple/code/nodejs/trial/baileys-api/dist/wa.js:141:34)","code":"P2025","clientVersion":"4.7.1","name":"NotFoundError"},"msg":"An error occured during session read"} {"level":50,"time":1675673785509,"pid":26620,"hostname":"MacBook-Air.local","err":{"type":"NotFoundError","message":"No Session found","stack":"NotFoundError: No Session found\n at /Users/apple/code/nodejs/trial/baileys-api/node_modules/@prisma/client/runtime/index.js:34062:15\n at async /Users/apple/code/nodejs/trial/baileys-api/node_modules/@prisma/client/runtime/index.js:34060:20\n at async read (/Users/apple/code/nodejs/trial/baileys-api/node_modules/@ookamiiixd/baileys-store/dist/session.js:28:30)\n at async useSession (/Users/apple/code/nodejs/trial/baileys-api/node_modules/@ookamiiixd/baileys-store/dist/session.js:50:20)\n at async createSession (/Users/apple/code/nodejs/trial/baileys-api/dist/wa.js:141:34)","code":"P2025","clientVersion":"4.7.1","name":"NotFoundError"},"msg":"An error occured during session read"}

get request: curl --location --request GET 'http://localhost:3000/sessions/john/add-sse'

data: {"connection":"connecting","receivedPendingNotifications":false}

data: {"connection":"close","lastDisconnect":{"error":{"data":{"code":"UNABLE_TO_VERIFY_LEAF_SIGNATURE"},"isBoom":true,"isServer":true,"output":{"statusCode":500,"payload":{"statusCode":500,"error":"Internal Server Error","message":"An internal server error occurred"},"headers":{}}},"date":"2023-02-06T08:58:54.810Z"}}

data: {"connection":"connecting","receivedPendingNotifications":false}

data: {"connection":"close","lastDisconnect":{"error":{"data":{"code":"UNABLE_TO_VERIFY_LEAF_SIGNATURE"},"isBoom":true,"isServer":true,"output":{"statusCode":500,"payload":{"statusCode":500,"error":"Internal Server Error","message":"An internal server error occurred"},"headers":{}}},"date":"2023-02-06T08:59:00.500Z"}}

data: {"connection":"connecting","receivedPendingNotifications":false}

data: {"connection":"close","lastDisconnect":{"error":{"data":{"code":"UNABLE_TO_VERIFY_LEAF_SIGNATURE"},"isBoom":true,"isServer":true,"output":{"statusCode":500,"payload":{"statusCode":500,"error":"Internal Server Error","message":"An internal server error occurred"},"headers":{}}},"date":"2023-02-06T08:59:05.606Z"}}

data: {"connection":"connecting","receivedPendingNotifications":false}

data: {"connection":"close","lastDisconnect":{"error":{"data":{"code":"UNABLE_TO_VERIFY_LEAF_SIGNATURE"},"isBoom":true,"isServer":true,"output":{"statusCode":500,"payload":{"statusCode":500,"error":"Internal Server Error","message":"An internal server error occurred"},"headers":{}}},"date":"2023-02-06T08:59:10.739Z"}}

data: {"connection":"connecting","receivedPendingNotifications":false}

data: {"connection":"close","lastDisconnect":{"error":{"data":{"code":"UNABLE_TO_VERIFY_LEAF_SIGNATURE"},"isBoom":true,"isServer":true,"output":{"statusCode":500,"payload":{"statusCode":500,"error":"Internal Server Error","message":"An internal server error occurred"},"headers":{}}},"date":"2023-02-06T08:59:15.831Z"}}

data: {"connection":"connecting","receivedPendingNotifications":false}

ookamiiixd commented 1 year ago

What database did you use?

rsaisankalp commented 1 year ago

Mysql

ookamiiixd commented 1 year ago

Did you only tried with the SSE one or you have tried using the POST one as well?

rsaisankalp commented 1 year ago

Both I have tried. Tried testing prisma by small code in create session while quering that is also working fine.

Seems to be Bailey issue dont known. Tried with multiple nodejs versions clearing. Other things as seen in stackoverflow

Nothing seems to work. Pls help

ookamiiixd commented 1 year ago

I'm not sure what the problem is, but seems like UNABLE_TO_VERIFY_LEAF_SIGNATURE is something related with a certificate

rsaisankalp commented 1 year ago

tried with a process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0'; as well. not sure

ookamiiixd commented 1 year ago

Have you ever do something with your CA store? Like installing something that intercept requests like Charles?

ookamiiixd commented 1 year ago

Closing this due to inactivity