Open 7xa5h opened 1 year ago
This is an issue with Windows only (Specifically, any terminal for Windows outside of WSL since that's a Linux VM and it works fine there?!). Powershell, Git Bash, and CMD are affected.
What's going on? Discord.js (or undici) is timing out getting the gateway URL to be used for requests.
Is there a workaround? Use WSL. It doesn't happen in WSL, just Windows. (Windows Subsystem for Linux)
This is an issue with Windows only (Specifically, any terminal for Windows outside of WSL since that's a Linux VM and it works fine there?!). Powershell, Git Bash, and CMD are affected.
What's going on? Discord.js (or undici) is timing out getting the gateway URL to be used for requests.
Is there a workaround? Use WSL. It doesn't happen in WSL, just Windows. (Windows Subsystem for Linux)
Would a Linux terminal emulator like cygwin or mysys2 fix the issue?
This is an issue with Windows only (Specifically, any terminal for Windows outside of WSL since that's a Linux VM and it works fine there?!). Powershell, Git Bash, and CMD are affected. What's going on? Discord.js (or undici) is timing out getting the gateway URL to be used for requests. Is there a workaround? Use WSL. It doesn't happen in WSL, just Windows. (Windows Subsystem for Linux)
Would a Linux terminal emulator like cgywin or mysys2 fix the issue?
Also on another note how does that imply that discord.js is now supported when it clearly doesnt work on 1 of the most used operating systems?
Discord.js is supported, Windows is just being :skull: as usual. I doubt a terminal emulator would help. :(
This is me, not being happy with you. >:/
Why? Because Deno 1.35.1 introduced a regression that broke discord.js!!!
This error does NOT OCCUR prior to Deno 1.35.1 (Deno 1.35 works fine). The newest version of Deno introduced this regression!!!! This is also a non-specific regression- every OS is affected.
no-de-no-de
on Discord.js has been merged. This should have solved the issue. Let me test that.
EDIT: Windows works fine now (On 1.35.0), BUT the existing regression on 1.35.1 still exists. The windows tag should be removed. If you want to use discord.js run deno upgrade --version 1.35.0
to revert to 1.35.0.
Time to wait for Deno to make a release again so I don't have to use Canary...
hm, after updating to Deno 1.35.2 it seems like im still getting the same error. is there any chance its being caused by my operating system, as im not using stock windows 11 but rather Mini11, a lightweight version without all the ms apps. heres the error message
error: Uncaught AbortError: Request aborted
at abort (file:///C:/Users/xash/AppData/Local/deno/npm/registry.npmjs.org/undici/5.22.1/lib/api/abort-signal.js:10:18)
at AbortSignal.self.<computed> (file:///C:/Users/xash/AppData/Local/deno/npm/registry.npmjs.org/undici/5.22.1/lib/api/abort-signal.js:29:5)
at innerInvokeEventListeners (ext:deno_web/02_event.js:792:7)
at invokeEventListeners (ext:deno_web/02_event.js:839:5)
at dispatch (ext:deno_web/02_event.js:696:9)
at AbortSignal.dispatchEvent (ext:deno_web/02_event.js:1101:12)
at AbortSignal.[[[signalAbort]]] (ext:deno_web/03_abort_signal.js:97:10)
at AbortController.abort (ext:deno_web/03_abort_signal.js:170:30)
at Timeout._onTimeout (file:///C:/Users/xash/AppData/Local/deno/npm/registry.npmjs.org/@discordjs/rest/1.7.1/dist/index.js:589:71)
at cb (ext:deno_node/internal/timers.mjs:63:31)
versions: deno 1.35.2 (release, x86_64-pc-windows-msvc) v8 11.6.189.7 typescript 5.1.6
It's hard to say. We'll try to reproduce the problem on Windows.
Works for me on 1.35.2
Maybe this is Mini11? @7xa5h try in a w11 VM pls (not mini11, full w11)
Works for me on 1.35.2
Maybe this is Mini11? @7xa5h try in a w11 VM pls (not mini11, full w11)
I unfortunately cant, as my system cant even support windows 11 atm. But i have contacted one of the Mini11 developers and he was pretty sure it wasnt an issue with Mini11. However, if you can, and want, you could test it on Mini11 as the setup is very very lightweight and seamless
The w11 requirements are a joke and can easily be bypassed.
The w11 requirements are a joke and can easily be bypassed.
my computer simply cant handle them lol, its like a really low end crappy laptop
I use Windows 11 Pro and it doesn't work with similar errors.
PS D:\Desktop\Projects\Discord\Deno> deno run --allow-all index.ts
error: Uncaught AbortError: Request aborted
at abort (file:///D:/Desktop/Projects/Discord/Deno/node_modules/.deno/undici@5.22.1/node_modules/undici/lib/api/abort-signal.js:10:18)
at AbortSignal.self.<computed> (file:///D:/Desktop/Projects/Discord/Deno/node_modules/.deno/undici@5.22.1/node_modules/undici/lib/api/abort-signal.js:29:5)
at innerInvokeEventListeners (ext:deno_web/02_event.js:792:7)
at invokeEventListeners (ext:deno_web/02_event.js:839:5)
at dispatch (ext:deno_web/02_event.js:696:9)
at AbortSignal.dispatchEvent (ext:deno_web/02_event.js:1101:12)
at AbortSignal.[[[signalAbort]]] (ext:deno_web/03_abort_signal.js:97:10)
at AbortController.abort (ext:deno_web/03_abort_signal.js:170:30)
at Timeout._onTimeout (file:///D:/Desktop/Projects/Discord/Deno/node_modules/.deno/discord.js@14.7.1/node_modules/@discordjs/rest/dist/index.js:589:71)
at cb (ext:deno_node/internal/timers.mjs:63:31)
deno 1.35.2 (release, x86_64-pc-windows-msvc) v8 11.6.189.7 typescript 5.1.6
https://github.com/denoland/deno/issues/19532 Does discord.js use undici, so it won't work until the undici problem is resolved?
19532 Does discord.js use undici, so it won't work until the undici problem is resolved?
Discord.js does use undici, no-de-no-de
was supposed to changed that but the dev builds for me all also used undici and not native fetch(), maybe we'll simply have to wait for either Deno to support undici or for djs to release a new version
I use Windows 11 Pro and it doesn't work with similar errors.
PS D:\Desktop\Projects\Discord\Deno> deno run --allow-all index.ts error: Uncaught AbortError: Request aborted at abort (file:///D:/Desktop/Projects/Discord/Deno/node_modules/.deno/undici@5.22.1/node_modules/undici/lib/api/abort-signal.js:10:18) at AbortSignal.self.<computed> (file:///D:/Desktop/Projects/Discord/Deno/node_modules/.deno/undici@5.22.1/node_modules/undici/lib/api/abort-signal.js:29:5) at innerInvokeEventListeners (ext:deno_web/02_event.js:792:7) at invokeEventListeners (ext:deno_web/02_event.js:839:5) at dispatch (ext:deno_web/02_event.js:696:9) at AbortSignal.dispatchEvent (ext:deno_web/02_event.js:1101:12) at AbortSignal.[[[signalAbort]]] (ext:deno_web/03_abort_signal.js:97:10) at AbortController.abort (ext:deno_web/03_abort_signal.js:170:30) at Timeout._onTimeout (file:///D:/Desktop/Projects/Discord/Deno/node_modules/.deno/discord.js@14.7.1/node_modules/@discordjs/rest/dist/index.js:589:71) at cb (ext:deno_node/internal/timers.mjs:63:31)
deno 1.35.2 (release, x86_64-pc-windows-msvc) v8 11.6.189.7 typescript 5.1.6
19532 Does discord.js use undici, so it won't work until the undici problem is resolved?
use discord.js@dev
, main d.js uses Undici still
use
discord.js@dev
, main d.js uses Undici still
in my case even @dev
uses Undici
any updates on this?
I've been testing this over and over and cannot reproduce. It sounds like a localized problem.
@KohnoseLami hasn't responded with the results of using @dev
so we can only assume that was the problem.
You're on an unsupported distro that might be messing with djs's ability to determine you're using Deno.
Oh, sorry. I haven't been able to reply.
I get similar errors when I use @dev
as well.
PS D:\Desktop\Projects\Discord\Deno> deno run --unstable --allow-all index.ts
error: Uncaught AbortError: Request aborted
at abort (file:///D:/Desktop/Projects/Discord/Deno/node_modules/.deno/undici@5.22.1/node_modules/undici/lib/api/abort-signal.js:10:18)
at AbortSignal.self.<computed> (file:///D:/Desktop/Projects/Discord/Deno/node_modules/.deno/undici@5.22.1/node_modules/undici/lib/api/abort-signal.js:29:5)
at innerInvokeEventListeners (ext:deno_web/02_event.js:792:7)
at invokeEventListeners (ext:deno_web/02_event.js:839:5)
at dispatch (ext:deno_web/02_event.js:696:9)
at AbortSignal.dispatchEvent (ext:deno_web/02_event.js:1101:12)
at AbortSignal.[[[signalAbort]]] (ext:deno_web/03_abort_signal.js:97:10)
at AbortController.abort (ext:deno_web/03_abort_signal.js:170:30)
at Timeout._onTimeout (file:///D:/Desktop/Projects/Discord/Deno/node_modules/.deno/discord.js@14.7.2-dev.1670069017-86959ba.0/node_modules/@discordjs/rest/dist/index.js:589:71)
at cb (ext:deno_node/internal/timers.mjs:63:31)
https://github.com/denoland/deno/issues/19766#issuecomment-1646246183
I agree with this comment. discord.js still used undici, and no-de-no-de
didn't seem to completely remove it.
https://github.com/discordjs/discord.js/pull/9683/files
I'm not sure what the main change in this pull request was, but at least it doesn't seem to complete change the undici implementation in discord.js to a fetch implementation.
So I don't think you can use discord.js with Deno on Windows unless the deno project either improves compatibility with undici or gets rid of it from discord.js. https://github.com/discordjs/discord.js/pull/9683/files
Wait, if https://github.com/denoland/deno/commit/51b3534b3d3833667e8c029564bebf319b0d2596 didnt fix the undici
issue then what did it even do?
That's the neat part, it should have.
On my environment, it uses native Deno (evidenced by an ENTIRELY DIFFERENT ERROR MESSAGE).
Hey, author of the no-de-no-de PR here.
Would like to clarify a few things about the PR, why installing @dev
isn't working (there's 2 reasons) and hopefully that'll help out a bit.
Undici isn't going away in node at this time (or probably ever). After the PR is released properly, using @discordjs/rest
in deno/bun/cf workers/etc (or installing a discord.js version that uses a version of @discordjs/rest
that has the branch in) will use native fetch instead of undici. This is done because undici's request is much faster than fetch in the current node implementation (there's some issues opened for performance issues related to this).
Currently you cannot use @dev
for two reasons:
Unfortunately your best bet is to either hopefully ses this issue solved (some people have it, some don't, I've consistently gotten it but know someone who hasn't on the same deno version), or be patient until we release and bump everything (which I cannot give an ETA for).
Hope that helps. If you're looking for instructions on how I tested the changes out I can probably write them in a gist when back
Undici isn't going away in node at this time (or probably ever). After the PR is released properly, using
@discordjs/rest
in deno/bun/cf workers/etc (or installing a discord.js version that uses a version of@discordjs/rest
that has the branch in) will use native fetch instead of undici. This is done because undici's request is much faster than fetch in the current node implementation (there's some issues opened for performance issues related to this).
Could you clarify what you mean by "going away in node", isn't the fix supposed to be in djs itself? Another question whats the difference between /rest and the normal version of discord.js (sorry i kinda dk alot ab djs)
Undici isn't going away in node at this time (or probably ever). After the PR is released properly, using
@discordjs/rest
in deno/bun/cf workers/etc (or installing a discord.js version that uses a version of@discordjs/rest
that has the branch in) will use native fetch instead of undici. This is done because undici's request is much faster than fetch in the current node implementation (there's some issues opened for performance issues related to this).Could you clarify what you mean by "going away in node", isn't the fix supposed to be in djs itself? Another question whats the difference between /rest and the normal version of discord.js (sorry i kinda dk alot ab djs)
/rest is a package used by djs for requests to Discord's API. It's the underlying cause of your errors since Undici Nonsense
could someone quickly check if 1.36 fixes the issue as i dont currently have my devices EDIT: ive seen that discord.js has made a new release could anyone also check that too
it seems that the issue is fixed, ive tested it on my Windows machine alongside Deno 1.36.1 and DJS 14.12.1, however i still see an "error" that i dont quite understand, could smeone explain what ClientRequest.options.createConnection
means?
import { Client, GatewayIntentBits, Partials } from "npm:discord.js@14.12.1";
import config from "./config.json" assert { type: "json" };
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
],
partials: [
Partials.Channel,
Partials.GuildMember,
Partials.Reaction,
Partials.ThreadMember,
Partials.User,
],
});
// client.config = config;
client
.login(config.token)
.then(() => console.log(`🟩 [LOGIN] Client logged in as ${client.user?.username}`))
// .catch((err) => console.error(`🟥 [LOGIN] ${err}`));
That's just the main way some packages do websockets. There's always a fallback, so don't worry :)
so as i understand this, djs works with the integrated workaround?
so as i understand this, djs works with the integrated workaround?
Not exactly. There's no workaround, they've just added code to use the native Websocket implementation other JS runtimes provide (ex. Deno).
so as i understand this, djs works with the integrated workaround?
Not exactly. There's no workaround, they've just added code to use the native Websocket implementation other JS runtimes provide (ex. Deno).
REST* implementation (via global fetch). Native websocket is waiting on Bun to fix their WS Client
The recent Deno 1.35 release announced support for popular NPM libraries, including
discord.js
. However, when testing Deno v1.35 with the latestdiscord.js
version, I encountered an AbortError with the message "Request Aborted". This issue persists despite the claimed support fordiscord.js
in the Deno 1.35 release.The AbortError destroys functionality of
discord.js
applications in Deno, making it impossible to use alongside Deno. This issue has persisted even before the Deno 1.35 release.The specific code is a basic boilerplate code that I adapted from discordjs.guide to make it compatible with Deno, which you can see below:
Versions: deno 1.35.0 (release, x86_64-pc-windows-msvc) v8 11.6.189.7 typescript 5.1.6 discord.js 14.11.0