Kay
Kay8mo ago

Invalid protocol value while using websockets

When using discord.js with deno and i try logging my bot in it returns error: Uncaught (in promise) SyntaxError: Invalid protocol value. When trying to login using node it works fine my full logs:
[INFO] 2024-05-23T04:42:00.418Z Registring events.
[DEBUG] 2024-05-23T04:42:00.458Z Registered interactionCreate
[DEBUG] 2024-05-23T04:42:00.478Z Registered ready
[INFO] 2024-05-23T04:42:00.481Z Registered events.
[DISCORD] [DEBUG] 2024-05-23T04:42:00.744Z Provided token: MTIwNDE1NDY5OTQzMjA3MTIyOQ.GLE-6a.**************************************
[DISCORD] [DEBUG] 2024-05-23T04:42:00.747Z Preparing to connect to the gateway...
[DISCORD] [DEBUG] 2024-05-23T04:42:00.924Z [WS => Manager] Fetched Gateway Information
URL: wss://gateway.discord.gg
Recommended Shards: 1
[DISCORD] [DEBUG] 2024-05-23T04:42:00.926Z [WS => Manager] Session Limit Information
Total: 1000
Remaining: 999
[DISCORD] [DEBUG] 2024-05-23T04:42:00.934Z [WS => Shard 0] Connecting to wss://gateway.discord.gg?v=10&encoding=json
error: Uncaught (in promise) SyntaxError: Invalid protocol value.
at new WebSocket (ext:deno_websocket/01_websocket.js:203:13)
at WebSocketShard.internalConnect (file:///C:/Users/titul/AppData/Local/deno/npm/registry.npmjs.org/@discordjs/ws/1.1.0/dist/index.js:675:24)
at eventLoopTick (ext:core/01_core.js:168:7)
[INFO] 2024-05-23T04:42:00.418Z Registring events.
[DEBUG] 2024-05-23T04:42:00.458Z Registered interactionCreate
[DEBUG] 2024-05-23T04:42:00.478Z Registered ready
[INFO] 2024-05-23T04:42:00.481Z Registered events.
[DISCORD] [DEBUG] 2024-05-23T04:42:00.744Z Provided token: MTIwNDE1NDY5OTQzMjA3MTIyOQ.GLE-6a.**************************************
[DISCORD] [DEBUG] 2024-05-23T04:42:00.747Z Preparing to connect to the gateway...
[DISCORD] [DEBUG] 2024-05-23T04:42:00.924Z [WS => Manager] Fetched Gateway Information
URL: wss://gateway.discord.gg
Recommended Shards: 1
[DISCORD] [DEBUG] 2024-05-23T04:42:00.926Z [WS => Manager] Session Limit Information
Total: 1000
Remaining: 999
[DISCORD] [DEBUG] 2024-05-23T04:42:00.934Z [WS => Shard 0] Connecting to wss://gateway.discord.gg?v=10&encoding=json
error: Uncaught (in promise) SyntaxError: Invalid protocol value.
at new WebSocket (ext:deno_websocket/01_websocket.js:203:13)
at WebSocketShard.internalConnect (file:///C:/Users/titul/AppData/Local/deno/npm/registry.npmjs.org/@discordjs/ws/1.1.0/dist/index.js:675:24)
at eventLoopTick (ext:core/01_core.js:168:7)
1 Reply
marvinh.
marvinh.8mo ago
That sounds like a bug in Deno's node compatibility layer. Can you file an issue here with steps to reproduce it? https://github.com/denoland/deno/issues/new/choose

Did you find this page helpful?