dilame / instagram-private-api

NodeJS Instagram private API SDK. Written in TypeScript.
MIT License
5.93k stars 1.14k forks source link

Randomly getting 500 error when sending links #1069

Open Androz2091 opened 4 years ago

Androz2091 commented 4 years ago

Bug Report

Form

Put an [x] if you meet the condition, else leave [ ].

Requirements

Description

I'm randomly getting a 500 Internal Server Error when the messages I send is containing links. Sometimes it works, sometimes it doesn't work. Do you know why?

YOUR DESCRIPTION HERE

Code

Just a broadcastText that contain a link.

Error and Output

(node:44377) UnhandledPromiseRejectionWarning: IgResponseError: POST /api/v1/direct_v2/threads/broadcast/link/ - 500 Internal Server Error; 
    at Request.handleResponseError (/Users/simon/Documents/GitHub/pronote-bot/node_modules/instagram-private-api/dist/core/request.js:121:16)
    at Request.send (/Users/simon/Documents/GitHub/pronote-bot/node_modules/instagram-private-api/dist/core/request.js:50:28)
    at async DirectThreadRepository.broadcast (/Users/simon/Documents/GitHub/pronote-bot/node_modules/instagram-private-api/dist/repositories/direct-thread.repository.js:176:26)
    at async DirectThreadEntity.broadcast (/Users/simon/Documents/GitHub/pronote-bot/node_modules/instagram-private-api/dist/entities/direct-thread.entity.js:157:26)
    at async DirectThreadEntity.broadcastLink (/Users/simon/Documents/GitHub/pronote-bot/node_modules/instagram-private-api/dist/entities/direct-thread.entity.js:69:16)
    at async InstaUser.send (/Users/simon/Documents/GitHub/pronote-bot/instagram/InstaUser.js:20:9)
(node:44377) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:44377) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
brunoferreiras commented 4 years ago

Is the same error happening to me, any solution?

Nerixyz commented 4 years ago

I think there was a similar issue on this, but I can't remember the solution nor find it. But generally for links you should use broadcastLink().

Androz2091 commented 4 years ago

Ok! And even if the message contains text too? For example Hello, here is the link: https://google.fr, we should use broadcastLink()?

Nerixyz commented 4 years ago

Ok! And even if the message contains text too? For example Hello, here is the link: https://google.fr, we should use broadcastLink()?

You have your message as it is and your links as an array.

Androz2091 commented 4 years ago

Thank you! I will test this as soon as possible