leonardssh / vscord

😎 Fully customizable VS Code extension to get Discord Rich Presence integration.
https://marketplace.visualstudio.com/items?itemName=LeonardSSH.vscord
MIT License
520 stars 106 forks source link

Couldn't connect to Discord via RPC #215

Closed EDM115 closed 6 months ago

EDM115 commented 1 year ago

First of all, i know that this issue already exists (#145 & #194)
But, I wanted to open a new one because this may be a little bit more specific

System : Windows 11 22H2 Build 22621.1778
Discord type : PTB
Discord version : 1.0.1027
BetterDiscord version : 1.9.2
Extension version : 5.1.10
VS Code version : 1.7.0-insider

That bug occured since... a while, ~3 months
I tried every workaround mentioned in the 2 above issues, without any success
Here's the log from the DevTools :

Couldn't connect to Discord via RPC: RPC_CONNECTION_TIMEOUT
  c             @ workbench.desktop.main.js:759
  (anonymous)       @ workbench.desktop.main.js:759
  invoke        @ workbench.desktop.main.js:93
  deliver       @ workbench.desktop.main.js:93
  fire          @ workbench.desktop.main.js:93
  addNotification   @ workbench.desktop.main.js:759
  notify        @ workbench.desktop.main.js:1638
  (anonymous)       @ workbench.desktop.main.js:1528
  d             @ workbench.desktop.main.js:1528
  $showMessage      @ workbench.desktop.main.js:1528
  N             @ workbench.desktop.main.js:1535
  M             @ workbench.desktop.main.js:1535
  H             @ workbench.desktop.main.js:1535
  G             @ workbench.desktop.main.js:1535
  (anonymous)       @ workbench.desktop.main.js:1535
  invoke        @ workbench.desktop.main.js:93
  deliver       @ workbench.desktop.main.js:93
  fire          @ workbench.desktop.main.js:93
  fire          @ workbench.desktop.main.js:564
  ee.onmessage      @ workbench.desktop.main.js:1636

Maybe using Discord PTB can be the source of the problem, or maybe it's due to BetterDiscord, tho one of my friends also have this configuration and it works perfectly

xhayper commented 1 year ago

47e554b18c4c311ac938be0076c08f6241cf3e63 should fix this

EDM115 commented 1 year ago
Activating extension 'LeonardSSH.vscord' failed: Extension 'vscode.git' is not known or not activated.
$onExtensionActivationError  @  mainThreadExtensionService.ts:113
   N  @  rpcProtocol.ts:455
   M  @  rpcProtocol.ts:440
   H  @  rpcProtocol.ts:370
   G  @  rpcProtocol.ts:296
   (anonymous)  @  rpcProtocol.ts:161
   w  @  event.ts:1089
   fire  @  event.ts:1120
   fire  @  ipc.net.ts:650
   oe.onmessage  @  localProcessExtensionHost.ts:583

after relaunch :

Couldn't connect to Discord via RPC: RPC_CONNECTION_TIMEOUT
c @ notificationsAlerts.ts:42
(anonymous) @ notificationsAlerts.ts:28
w @ event.ts:1089
x @ event.ts:1100
fire @ event.ts:1124
addNotification @ notifications.ts:204
notify @ notificationService.ts:175
(anonymous) @ mainThreadMessageService.ts:77
d @ mainThreadMessageService.ts:42
$showMessage @ mainThreadMessageService.ts:36
N @ rpcProtocol.ts:455
M @ rpcProtocol.ts:440
H @ rpcProtocol.ts:370
G @ rpcProtocol.ts:296
(anonymous) @ rpcProtocol.ts:161
w @ event.ts:1089
fire @ event.ts:1120
fire @ ipc.net.ts:650
oe.onmessage @ localProcessExtensionHost.ts:583
EDM115 commented 1 year ago

Update :
I tried to use it with a custom RPC implementation (Vencord Web + WebRichPresence (arRPC) plugin + local arRPC server) : https://github.com/OpenAsar/arrpc/
In VS Code, vscord shows his nice smiley because he's connected to Discord
According to the logs, the app is also connected :

PS C:\Windows\System32> Set-Location -Path "D:\EDM115\Téléchargements\arrpc"
PS D:\EDM115\Téléchargements\arrpc> node src
(node:8632) ExperimentalWarning: Import assertions are not a stable feature of the JavaScript language. Avoid relying on their current behavior and syntax as those might change in a future version of Node.js.
(Use `node --trace-warnings ...` to show where the warning was created)
[arRPC] arRPC v3.1.0
(node:8632) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
[arRPC > bridge] listening on 1337
[arRPC > ipc] listening at \\?\pipe\discord-ipc-0
[arRPC > websocket] listening on 6463
[arRPC > process] started
[arRPC > bridge] web connected
[arRPC > ipc] new connection!

however it doesn't appear on my profile

also, after some time, a window reload or a workspace change, vscord disappears from VS Code, here are the logs :

[arRPC > ipc] socket closed false

and when i try to interact with the extension through commands, I got the same error as #238

EDM115 commented 1 year ago

Update (again) :

I was seeking for more info on the Dev Tools, and one extension gave constant errors so I disabled it for convenience (it was hurly.sqltools-oracle-driver)
After reloading, Output -> VSCord gave something ! It was apparently transferring data to Discord, tho nothing appeared in the Discord profile
One more reload and the same error is here (#238), but with a different traceback :

Activating extension 'LeonardSSH.vscord' failed: Extension 'vscode.git' is not known or not activated.
$onExtensionActivationError @ mainThreadExtensionService.ts:113
S @ rpcProtocol.ts:456
Q @ rpcProtocol.ts:441
M @ rpcProtocol.ts:371
L @ rpcProtocol.ts:297
(anonymous) @ rpcProtocol.ts:161
z @ event.ts:1138
fire @ event.ts:1169
fire @ ipc.net.ts:650
Y.onmessage @ localProcessExtensionHost.ts:581

and the output is now :

[12:13:19 PM] [INFO] [data.ts] ext(): Extension
[12:13:19 PM] [INFO] [data.ts] ext(): Changed to Extension
[12:13:19 PM] [INFO] [data.ts] [data.ts] ext(): activate
EDM115 commented 1 year ago

sometimes, after random reloads, I get some output and no error, but it doesn't show up on discord
https://nekobin.com/cixacebovo

EDM115 commented 1 year ago

probably unrelated :

ERR Error: ENOENT: no such file or directory, stat 'c:\Users\EDM115\AppData\Roaming\Code - Insiders\logs\20231002T115248\window1\exthost\output_logging_20231002T123128\13-VSCord.log': EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, stat 'c:\Users\EDM115\AppData\Roaming\Code - Insiders\logs\20231002T115248\window1\exthost\output_logging_20231002T123128\13-VSCord.log'
    at i.create (D:\EDM115\Programmes\Microsoft VS Code Insiders\resources\app\out\vs\code\electron-main\main.js:54:3400)
    at n (D:\EDM115\Programmes\Microsoft VS Code Insiders\resources\app\out\vs\code\electron-main\main.js:54:3512)
    at t.eb (D:\EDM115\Programmes\Microsoft VS Code Insiders\resources\app\out\vs\code\electron-main\main.js:59:35044)
    at t.stat (D:\EDM115\Programmes\Microsoft VS Code Insiders\resources\app\out\vs\code\electron-main\main.js:59:27620)

the files exists tho

EDM115 commented 7 months ago

quick update, now with the following infos :

[3:17:03 PM] [INFO] [data.ts] ext(): Extension
[3:17:03 PM] [INFO] [data.ts] ext(): Changed to Extension
[3:17:03 PM] [INFO] [data.ts] [data.ts] ext(): Git extension is active
[3:17:03 PM] [INFO] [data.ts] api(): true
[3:17:03 PM] [INFO] [data.ts] api(): gitApi
[3:17:03 PM] [INFO] [data.ts] updateGit()
[3:17:03 PM] [INFO] [data.ts] repo(): no file open
[3:17:03 PM] [INFO] [data.ts] gitRepoPath(): d:\EDM115\Documents\Projects\palex
[3:17:03 PM] [INFO] [data.ts] updateGit(): repo d:\EDM115\Documents\Projects\palex
[3:17:03 PM] [INFO] [data.ts] api(): true
[3:17:03 PM] [INFO] [data.ts] api(): gitApi
[3:17:03 PM] [INFO] [data.ts] updateGit()
[3:17:03 PM] [INFO] [data.ts] repo(): no file open
[3:17:03 PM] [INFO] [data.ts] gitRepoPath(): d:\EDM115\Documents\Projects\palex
[3:17:03 PM] [INFO] [data.ts] updateGit(): repo d:\EDM115\Documents\Projects\palex
[3:17:03 PM] [INFO] [003] Debug: CLIENT => SERVER | OPCODE.HANDSHAKE | {
  "v": 1,
  "client_id": "VS Code Insiders"
}
[3:17:03 PM] [INFO] Discord Rich Presence for VS Code activated.
[3:17:03 PM] [INFO] Registered Discord Rich Presence commands
[3:17:03 PM] [INFO] [003] Debug: SERVER => CLIENT | 02 00 00 00 2B 00 00 00 7B 22 63 6F 64 65 22 3A 34 30 30 30 2C 22 6D 65 73 73 61 67 65 22 3A 22 49 6E 76 61 6C 69 64 20 43 6C 69 65 6E 74 20 49 44 22 7D
[3:17:03 PM] [INFO] [003] Debug: SERVER => CLIENT | OPCODE.CLOSE | {
  "code": 4000,
  "message": "Invalid Client ID"
}
[3:17:13 PM] [ERROR] Encountered following error while trying to login: RPC_CONNECTION_TIMEOUT: Connection timed out
    at ks.login (D:\EDM115\UserFiles\.vscode-insiders\extensions\leonardssh.vscord-5.2.10\node_modules\.pnpm\@xhayper+discord-rpc@1.1.2\node_modules\@xhayper\discord-rpc\dist\Client.js:262:20)
    at new pn (D:\EDM115\UserFiles\.vscode-insiders\extensions\leonardssh.vscord-5.2.10\src\controller.ts:43:26)
    at Object.<anonymous> (D:\EDM115\UserFiles\.vscode-insiders\extensions\leonardssh.vscord-5.2.10\src\extension.ts:12:20)
    at Module.o._compile (d:\EDM115\Programmes\Microsoft VS Code Insiders\resources\app\out\vs\loader.js:4:1271)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1326:10)
    at Module.load (node:internal/modules/cjs/loader:1126:32)
    at Module._load (node:internal/modules/cjs/loader:967:12)
    at Function.c._load (node:electron/js2c/node_init:2:13672)
    at Function.g._load (d:\EDM115\Programmes\Microsoft VS Code Insiders\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:176:5607)
    at Function.i._load (d:\EDM115\Programmes\Microsoft VS Code Insiders\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:173:29719)
    at Function.t._load (d:\EDM115\Programmes\Microsoft VS Code Insiders\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:138:35317)
    at Module.require (node:internal/modules/cjs/loader:1150:19)
    at Module.require (D:\EDM115\UserFiles\.vscode-insiders\extensions\cweijan.vscode-office-3.3.2\out\extension.js:101:4622)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Function.i [as __$__nodeRequire] (d:\EDM115\Programmes\Microsoft VS Code Insiders\resources\app\out\vs\loader.js:5:98)
    at l.xb (d:\EDM115\Programmes\Microsoft VS Code Insiders\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:173:30898)
    at async Promise.all (index 0)
[3:17:13 PM] [INFO] [002] Destroyed Discord RPC client
[3:17:34 PM] [INFO] [data.ts] root(): window.onDidChangeActiveTextEditor
[3:17:34 PM] [INFO] [data.ts] root(): window.onDidChangeActiveTextEditor: got unallowed scheme, got 'output'
[3:17:46 PM] [INFO] [data.ts] root(): window.onDidChangeActiveTextEditor
[3:17:49 PM] [INFO] Reconnecting to Discord Gateway...
[3:17:49 PM] [INFO] [004] Debug: Logging in with client ID "VS Code Insiders"
[3:17:49 PM] [INFO] [004] Debug: Login - isConnected false isReady VS Code Insiders
[3:17:49 PM] [INFO] [004] Debug: Login - [object Object]
[3:17:49 PM] [INFO] [003] Debug: CLIENT => SERVER | OPCODE.HANDSHAKE | {
  "v": 1,
  "client_id": "VS Code Insiders"
}
[3:17:50 PM] [INFO] [003] Debug: SERVER => CLIENT | 02 00 00 00 2B 00 00 00 7B 22 63 6F 64 65 22 3A 34 30 30 30 2C 22 6D 65 73 73 61 67 65 22 3A 22 49 6E 76 61 6C 69 64 20 43 6C 69 65 6E 74 20 49 44 22 7D
[3:17:50 PM] [INFO] [003] Debug: SERVER => CLIENT | OPCODE.CLOSE | {
  "code": 4000,
  "message": "Invalid Client ID"
}
[3:18:07 PM] [INFO] Disabled Discord Rich Presence
[3:18:07 PM] [INFO] [003] Destroyed Discord RPC client
[3:18:12 PM] [INFO] [003] Destroyed Discord RPC client
[3:18:12 PM] [INFO] [004] Debug: Enabling Discord Rich Presence
[3:18:12 PM] [INFO] [004] Debug: Logging in with client ID "VS Code Insiders"
[3:18:12 PM] [INFO] [004] Debug: Login - isConnected false isReady VS Code Insiders
[3:18:12 PM] [INFO] [004] Debug: Login - [object Object]
[3:18:12 PM] [INFO] [003] Debug: CLIENT => SERVER | OPCODE.HANDSHAKE | {
  "v": 1,
  "client_id": "VS Code Insiders"
}
[3:18:12 PM] [INFO] [003] Debug: SERVER => CLIENT | 02 00 00 00 2B 00 00 00 7B 22 63 6F 64 65 22 3A 34 30 30 30 2C 22 6D 65 73 73 61 67 65 22 3A 22 49 6E 76 61 6C 69 64 20 43 6C 69 65 6E 74 20 49 44 22 7D
[3:18:12 PM] [INFO] [003] Debug: SERVER => CLIENT | OPCODE.CLOSE | {
  "code": 4000,
  "message": "Invalid Client ID"
}
[3:18:32 PM] [INFO] Reconnecting to Discord Gateway...
[3:18:32 PM] [INFO] [004] Debug: Logging in with client ID "VS Code Insiders"
[3:18:32 PM] [INFO] [004] Debug: Login - isConnected false isReady VS Code Insiders
[3:18:32 PM] [INFO] [004] Debug: Login - [object Object]
[3:18:32 PM] [INFO] [003] Debug: CLIENT => SERVER | OPCODE.HANDSHAKE | {
  "v": 1,
  "client_id": "VS Code Insiders"
}
[3:18:33 PM] [INFO] [003] Debug: SERVER => CLIENT | 02 00 00 00 2B 00 00 00 7B 22 63 6F 64 65 22 3A 34 30 30 30 2C 22 6D 65 73 73 61 67 65 22 3A 22 49 6E 76 61 6C 69 64 20 43 6C 69 65 6E 74 20 49 44 22 7D
[3:18:33 PM] [INFO] [003] Debug: SERVER => CLIENT | OPCODE.CLOSE | {
  "code": 4000,
  "message": "Invalid Client ID"
}
[3:18:51 PM] [INFO] [data.ts] root(): window.onDidChangeActiveTextEditor
[3:18:51 PM] [INFO] [data.ts] root(): window.onDidChangeActiveTextEditor: got unallowed scheme, got 'output'
ItsPi3141 commented 6 months ago

quick update, now with the following infos :

  • VS Code : Insiders 1.90.0
  • Discord : ptb 290322 (36d009f), Host 1.0.1079 x64 (47429), Windows 11 64-bit (10.0.22635)
  • BetterDiscord : stable 1.10.1
[3:17:03 PM] [INFO] [003] Debug: CLIENT => SERVER | OPCODE.HANDSHAKE | {
  "v": 1,
  "client_id": "VS Code Insiders"
}
[3:17:03 PM] [INFO] Discord Rich Presence for VS Code activated.
[3:17:03 PM] [INFO] Registered Discord Rich Presence commands
[3:17:03 PM] [INFO] [003] Debug: SERVER => CLIENT | 02 00 00 00 2B 00 00 00 7B 22 63 6F 64 65 22 3A 34 30 30 30 2C 22 6D 65 73 73 61 67 65 22 3A 22 49 6E 76 61 6C 69 64 20 43 6C 69 65 6E 74 20 49 44 22 7D
[3:17:03 PM] [INFO] [003] Debug: SERVER => CLIENT | OPCODE.CLOSE | {
  "code": 4000,
  "message": "Invalid Client ID"
}
[3:17:13 PM] [ERROR] Encountered following error while trying to login: RPC_CONNECTION_TIMEOUT: Connection timed out
  1. Go to settings
  2. Search for vscord.app.id
  3. Set the value to 782685898163617802

Hopefully that fixes it!

EDM115 commented 6 months ago

thanks @ItsPi3141, i was just stupid while making my config ❤️