Skip to content
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

discord - Login error: Failed to switch to websocket mode (and 400 bad request from cloudflare) #237

Open
MatthewVernon opened this issue Sep 27, 2023 · 3 comments

Comments

@MatthewVernon
Copy link

bitlbee-discord 0.4.3
bitlbee 3.6-1.3
[Debian bookworm]

After ~1y away, I tried using bitlbee to talk to discord again. My IRC client just reports:

<root> Trying to get all accounts connected...
<root> discord - Login error: Failed to switch to websocket mode
<root> discord - Logging in: Signing off..
<root> discord - Logging in: Reconnecting in 5 seconds..

Running bitlbee with BITLBEE_DEBUG=1 it looks like cloudflare is saying 400 bad request:

[14:43:22] >>> ((null)) discord_http_get 188
About to send HTTP request:
GET /api/gateway HTTP/1.1
Host: discordapp.com
User-Agent: Bitlbee-Discord
Content-Type: application/json
authorization: REDACTED

HTTP response headers:
HTTP/1.1 200 OK
Date: Wed, 27 Sep 2023 13:43:22 GMT
Content-Type: application/json
Content-Length: 35
Connection: keep-alive
strict-transport-security: max-age=31536000; includeSubDomains
Via: 1.1 google
Alt-Svc: h3=":443"; ma=86400
CF-Cache-Status: HIT
Age: 72869
Last-Modified: Tue, 26 Sep 2023 17:28:53 GMT
Expires: Wed, 27 Sep 2023 13:43:52 GMT
Cache-Control: public, max-age=30
Accept-Ranges: bytes
Set-Cookie: __cf_bm=REDACTED; path=/; expires=Wed, 27-Sep-23 14:13:22 GMT; domain=.discordapp.com; HttpOnly; Secure; SameSite=None
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=REDACTED"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Server: cloudflare
CF-RAY: REDACTED

Finishing HTTP request with status: 200 OK
[14:43:22] <<< ((null)) discord_http_gateway_cb [200] 35
{"url":"wss://gateway.discord.gg"}


[14:43:22] <<< ((null)) discord_ws_in_cb switching failure. buf:
HTTP/1.1 400 Bad Request
Server: cloudflare
Date: Wed, 27 Sep 2023 13:43:22 GMT
Content-Type: text/html
Content-Length: 155
Connection: close
CF-RAY: -

<html>
<head><title>400 Bad Request</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<hr><center>cloudflare</center>
</body>
</html>

[14:43:27] >>> ((null)) discord_http_get 188
About to send HTTP request:
GET /api/gateway HTTP/1.1
Host: discordapp.com
User-Agent: Bitlbee-Discord
Content-Type: application/json
authorization: REDACTED

HTTP response headers:
HTTP/1.1 200 OK
Date: Wed, 27 Sep 2023 13:43:27 GMT
Content-Type: application/json
Content-Length: 35
Connection: keep-alive
strict-transport-security: max-age=31536000; includeSubDomains
Via: 1.1 google
Alt-Svc: h3=":443"; ma=86400
CF-Cache-Status: HIT
Age: 72874
Last-Modified: Tue, 26 Sep 2023 17:28:53 GMT
Expires: Wed, 27 Sep 2023 13:43:57 GMT
Cache-Control: public, max-age=30
Accept-Ranges: bytes
Set-Cookie: __cf_bm=REDACTED; path=/; expires=Wed, 27-Sep-23 14:13:27 GMT; domain=.discordapp.com; HttpOnly; Secure; SameSite=None
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=REDACTED"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Server: cloudflare
CF-RAY: REDACTED

Finishing HTTP request with status: 200 OK
[14:43:28] <<< ((null)) discord_http_gateway_cb [200] 35
{"url":"wss://gateway.discord.gg"}


[14:43:28] <<< ((null)) discord_ws_in_cb switching failure. buf:
HTTP/1.1 400 Bad Request
Server: cloudflare
Date: Wed, 27 Sep 2023 13:43:28 GMT
Content-Type: text/html
Content-Length: 155
Connection: close
CF-RAY: -

<html>
<head><title>400 Bad Request</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
@sm00th
Copy link
Owner

sm00th commented Sep 27, 2023

Might be cloudfare being suspicious of your bitlbee host's ip address. Could you try tunneling through that machine (ssh -D) and trying to log into discord with it's ip via browser?

@MatthewVernon
Copy link
Author

The system I'm running bitlbee on is my desktop system (from which I've logged on via a web-browser)...

@sm00th
Copy link
Owner

sm00th commented Sep 29, 2023

I see. To be honest I've been neglecting this project for a while and I currently don't even have anything set up to properly test this issue and I am not sure when (or if) I'll have time for this.

My only other suggestion is trying re-create the account in bitlbee. If that doesn't help then probably other people are having this issue as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants