-
-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
disconnected
callback's "reason" parameter is blank
#319
Comments
Tried replicating this with the code currently on Git. Test details:
Node version:
NPM version:
With both tests I tried:
In both tests, both cases have This issue can be closed and marked as resolved. |
I have the same issue and i cant find the problem why my bot is disconnecting randomly from twitch. Test details: Node version: NPM version: |
@EightyNine |
My bot is joining the most channel with the join command. Here a chart to see the is broke up the connection without a reason. |
Was there ever any resolution to this? I have the same issue. I get:
Then in the disconnect logs all I get is
It seems like there is some kind of issue with my setup, but I don't get any other errors or descriptors as to what I might be doing incorrectly. Here's the snip for creating the client: const tokenPass = `${this.botAccount.token.token_type} ${this.botAccount.token.access_token}`;
this.twitchClient = new Client({
connection: {
maxReconnectAttempts: 5,
timeout: 18000,
},
channels: [this.botAccount.channel],
options: { debug: process.env.NODE_ENV === "development" },
identity: {
username: this.botAccount.username,
password: tokenPass,
},
});
this.twitchClient.on("disconnected", (reason) => {
logger.debug(
{ reason, twitchClient: this.twitchClient },
"Twitch Client Disconnected"
);
});
try {
await this.twitchClient.connect();
this.STATUS = "READY";
resolve();
logger.debug("Created and connected new authenticated twitch client");
} catch (err) {
reject(err);
this.STATUS = "ERROR";
logger.error(
{ err },
"Failed to connect new twitch authenticated client"
);
}
}); Connecting anonymously works 100% fine. It's only when authenticating that I have an issue. It seems like the authentication IS working, though. If I provide an incorrect bearer token I get a 400 invalid client. |
I got it working for myself, but holy heck was it a pain to figure out... Essentially after hours and hours of troubleshooting and trying different things it boiled down to not having a wide enough scope. Despite the documentation stating That doesn't appear to be the case. After I changed the authorization flow to use
As the OAuth token request, instead of
everything magically started working! There are TWO major differences...
Once I fixed the authorization request to use the above URI, sending the results to the server and using my previous workflow works 100%. I did change my code back to use the documented Here's what my working server-side code looks like:
My current project is kind of becoming a bit cumbersome to use as reference, so I wouldn't necessarily recommend it... But it IS currently working as-is at this point (though currently vastly under documented as it's just in the beginning phase of playing with stuff and figuring out what does and doesn't work). If anyone does want an example though, you can find my project here. Lastly, the resources I used to work backwards and figure this out:
If the maintainers were able to put together a simple minimal-viable working project example or something and link it in the docs, that would help tremendously. It'd also be a good idea to review the claims about needing only scopes Hope this helps someone who stumbles upon the topic like I did in the future. Good luck! |
Actual behaviour: The
disconnected
event'sreason
parameter for its callback is blank.Expected behaviour: The callback for the
disconnected
event would receive a string saying why it was disconnect.Code sample
Error log:
Server configuration
The text was updated successfully, but these errors were encountered: