Androz2091 / insta.js

💬 Object-oriented library for sending and receiving messages via Instagram
138 stars 42 forks source link

"ClientDisconnectedError: MQTToTClient got disconnected" and "IgCookieNotFoundError: Cookie "sessionid" not found" errors after logout #58

Closed kashirin-dm closed 3 years ago

kashirin-dm commented 3 years ago

Hello. I always get these errors after client.logout():

ClientDisconnectedError: MQTToTClient got disconnected. at SafeSubscriber._next (C:\PROJ\IG\node_modules\instagram_mqtt\dist\realtime\realtime.client.js:154:30) at SafeSubscriber.__tryOrUnsub (C:\PROJ\IG\node_modules\rxjs\internal\Subscriber.js:205:16) at SafeSubscriber.next (C:\PROJ\IG\node_modules\rxjs\internal\Subscriber.js:143:22) at Subscriber._next (C:\PROJ\IG\node_modules\rxjs\internal\Subscriber.js:89:26) at Subscriber.next (C:\PROJ\IG\node_modules\rxjs\internal\Subscriber.js:66:18) at Subject.next (C:\PROJ\IG\node_modules\rxjs\internal\Subject.js:60:25) at MQTToTClient.setDisconnected (C:\PROJ\IG\node_modules\mqtts\dist\mqtt.client.js:330:30) at Object.disconnect (C:\PROJ\IG\node_modules\mqtts\dist\mqtt.client.js:98:26) at TLSSocket.<anonymous> (C:\PROJ\IG\node_modules\mqtts\dist\transport\tls.transport.js:36:52) at TLSSocket.emit (events.js:327:22) at endReadableNT (internal/streams/readable.js:1327:12) at processTicksAndRejections (internal/process/task_queues.js:80:21)

IgCookieNotFoundError: Cookie "sessionid" not found at State.extractCookieValue (C:\PROJ\IG\node_modules\instagram-private-api\dist\core\state.js:142:19) at RealtimeClient.constructConnection (C:\PROJ\IG\node_modules\instagram_mqtt\dist\realtime\realtime.client.js:42:53) at MQTToTClient.payloadProvider [as connectPayloadProvider] (C:\PROJ\IG\node_modules\instagram_mqtt\dist\realtime\realtime.client.js: 92:22) at MQTToTClient.connect (C:\PROJ\IG\node_modules\instagram_mqtt\dist\mqttot\mqttot.client.js:38:42) at MQTToTClient.setDisconnected (C:\PROJ\IG\node_modules\mqtts\dist\mqtt.client.js:339:18) at Object.disconnect (C:\PROJ\IG\node_modules\mqtts\dist\mqtt.client.js:98:26) at TLSSocket.<anonymous> (C:\PROJ\IG\node_modules\mqtts\dist\transport\tls.transport.js:36:52) at TLSSocket.emit (events.js:327:22) at endReadableNT (internal/streams/readable.js:1327:12) at processTicksAndRejections (internal/process/task_queues.js:80:21)

And if I try to log in again WITHOUT RESTARTING the server, I will get this error:

ConnectionFailedError: CONNACK returnCode: 2 errorName: Identifier rejected at Object.next (C:\PROJ\IG\node_modules\instagram_mqtt\dist\mqttot\mqttot.client.js:72:23) at MQTToTClient.continueFlows (C:\PROJ\IG\node_modules\mqtts\dist\mqtt.client.js:212:104) at MQTToTClient.handlePacket (C:\PROJ\IG\node_modules\mqtts\dist\mqtt.client.js:291:19) at C:\PROJ\IG\node_modules\mqtts\dist\mqtt.client.js:247:43 at Array.forEach (<anonymous>) at MQTToTClient.parseData (C:\PROJ\IG\node_modules\mqtts\dist\mqtt.client.js:247:25) at processTicksAndRejections (internal/process/task_queues.js:93:5)

If I try to log in repeatedly, I will get this error every ~10 seconds:

ClientDisconnectedError: MQTToTClient got disconnected. at SafeSubscriber._next (C:\PROJ\IG\node_modules\instagram_mqtt\dist\realtime\realtime.client.js:154:30) at SafeSubscriber.__tryOrUnsub (C:\PROJ\IG\node_modules\rxjs\internal\Subscriber.js:205:16) at SafeSubscriber.next (C:\PROJ\IG\node_modules\rxjs\internal\Subscriber.js:143:22) at Subscriber._next (C:\PROJ\IG\node_modules\rxjs\internal\Subscriber.js:89:26) at Subscriber.next (C:\PROJ\IG\node_modules\rxjs\internal\Subscriber.js:66:18) at Subject.next (C:\PROJ\IG\node_modules\rxjs\internal\Subject.js:60:25) at MQTToTClient.setDisconnected (C:\PROJ\IG\node_modules\mqtts\dist\mqtt.client.js:330:30) at Object.disconnect (C:\PROJ\IG\node_modules\mqtts\dist\mqtt.client.js:98:26) at TLSSocket.<anonymous> (C:\PROJ\IG\node_modules\mqtts\dist\transport\tls.transport.js:36:52) at TLSSocket.emit (events.js:327:22) at endReadableNT (internal/streams/readable.js:1327:12) at processTicksAndRejections (internal/process/task_queues.js:80:21)

How can I restart a session without my server termination?

nerkoux commented 3 years ago

please try adding ; this in the eding --> client.logout();

nerkoux commented 3 years ago

MQTTclientgotdiscconected error shows that you've logged in your client account somewhere else so this client got disconnect.. Hope this helps.

kashirin-dm commented 3 years ago

please try adding ; this in the eding --> client.logout();

57 - pull request solves this problem. I made changes in node_modules like in this pull request and the problem is gone.

nerkoux commented 3 years ago

please try adding ; this in the eding --> client.logout();

57 - pull request solves this problem. I made changes in node_modules like in this pull request and the problem is gone.

Yeah 😃❤️

Androz2091 commented 3 years ago

awesome. thank you for your PR