denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
98.09k stars 5.4k forks source link

AbortError: Request aborted with npm specifiers #16684

Open Jakob5358 opened 2 years ago

Jakob5358 commented 2 years ago

Reproduction repo: https://github.com/Jakob5358/DJS-Deno-Test

The node version inside the 'node' dir with 'node index.js' works but not the deno version.

For this specific repro, you'll need to put a discord bot token in the TOKEN variable, you can get one by following these steps: go to https://discord.com/developers/applications -> create a new application -> press bot -> create new bot -> reset token -> copy token -> put it in the TOKEN variable

Then go in the project and run 'deno task start' and wait for just over a minute (I timed it). than you'll get an error which looks like this:

error: Uncaught AbortError: Request aborted
    at abort (file:///C:/Users/jbeta/AppData/Local/deno/npm/registry.npmjs.org/undici/5.12.0/lib/api/abort-signal.js:10:18)    
    at AbortSignal.self.<computed> (file:///C:/Users/jbeta/AppData/Local/deno/npm/registry.npmjs.org/undici/5.12.0/lib/api/abort-signal.js:29:5)
    at innerInvokeEventListeners (deno:ext/web/02_event.js:755:9)
    at invokeEventListeners (deno:ext/web/02_event.js:795:7)
    at dispatch (deno:ext/web/02_event.js:664:11)
    at AbortSignal.dispatchEvent (deno:ext/web/02_event.js:1043:14)
    at AbortSignal.[[[signalAbort]]] (deno:ext/web/03_abort_signal.js:86:12)
    at AbortController.abort (deno:ext/web/03_abort_signal.js:159:32)
    at Timeout.<anonymous> (file:///C:/Users/jbeta/AppData/Local/deno/npm/registry.npmjs.org/@discordjs/rest/1.3.0/dist/index.js:515:73)
    at https://deno.land/std@0.165.0/node/timers.ts:21:15

This is my first issue btw so let me know if anything is off. If you dont want to make your own bot and dont trust that package or whatever, I can send you a test bot token on discord.

khrj commented 2 years ago

I've been investigating the cause of this issue, and it turns out that this can be reproduced much more simply:

import { request } from "npm:undici"
await request("https://www.example.com")

fails with

error: Uncaught (in promise) ConnectTimeoutError: Connect Timeout Error
    at onConnectTimeout (file:///home/khushraj/.cache/deno/npm/registry.npmjs.org/undici/5.12.0/lib/core/connect.js:133:24)
    at file:///home/khushraj/.cache/deno/npm/registry.npmjs.org/undici/5.12.0/lib/core/connect.js:80:46
    at Timeout.<anonymous> (file:///home/khushraj/.cache/deno/npm/registry.npmjs.org/undici/5.12.0/lib/core/connect.js:121:9)
    at https://deno.land/std@0.164.0/node/timers.ts:21:15
    at Object.action (deno:ext/web/02_timers.js:147:13)
    at handleTimerMacrotask (deno:ext/web/02_timers.js:64:12)
Jakob5358 commented 2 years ago

Right, do you want to make a new issue?

khrj commented 2 years ago

16710