oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.12k stars 2.67k forks source link

ConnectionClosed: The socket connection was closed unexpectedly. For more information, pass `verbose: true` in the second argument to fetch() #9881

Open Cikaros opened 5 months ago

Cikaros commented 5 months ago

What version of Bun is running?

docker image oven/bun:latest

What platform is your computer?

docker image oven/bun:latest

What steps can reproduce the bug?

ConnectionClosed: The socket connection was closed unexpectedly. For more information, pass verbose: true in the second argument to fetch()

path: https://mikanani.me/RSS/Search?searchstr=GM-Team+%E5%AE%8C%E7%BE%8E%E4%B8%96%E7%95%8C

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

Electroid commented 5 months ago

Could you share the code that produces this, the following code seems to work:

bun --print 'fetch("https://mikanani.me/RSS/Search?searchstr=GM-Team+%E5%AE%8C%E7%BE%8E%E4%B8%96%E7%95%8C")'
zhuyankun commented 5 months ago

image

https://fq.beitai.cc/content

Could you share the code that produces this, the following code seems to work:

bun --print 'fetch("https://mikanani.me/RSS/Search?searchstr=GM-Team+%E5%AE%8C%E7%BE%8E%E4%B8%96%E7%95%8C")'
Andrew-Ku commented 4 months ago

I reproduce the same problem when I have VPN enabled. Without VPN it works fine

YANGLEDUO1 commented 3 months ago

image

const result = await mysql_util().query(`select id, mobile, cif_number cifNumber, customer_id customerId
                                         from life_member limit 2000`, [])
if (Array.isArray(result)) {
    members = result as Member[];
    for (let member of members) {
        promisesToken.push(fetch(`http://10.10.100.27:8998/oauth/token?grant_type=member_password&cifNumber=${member.cifNumber}&customerId=${member.customerId}`, {
            method: "GET",
            headers: {Authorization: `Basic bW9iaWxlOmJjVGVjaDIwMjA=`}
        }));
    }

    await Promise.all(promisesToken)
        .then(async responses => {
            for (let response of responses) {
                if (response.ok) {
                    const url = new URL(response.url)
                    const cifNumber = url.searchParams.get("cifNumber")
                    if (cifNumber) {
                        const resul = await response.json()
                        memberToken.set(cifNumber, resul["access_token"])
                    }
                }
            }
        }).catch(reason => console.error(`获取token 失败: ${reason}`))

A large number of asynchronous requests can repeat this problem

smaccoun commented 2 months ago

I just commented on another issue but I get this for all versions of Bun > v1.0.9 when using firebase-auth and calling verifyIdToken with a token with a custom claim

siarhei-semikau commented 2 months ago

This issue is active for windows 11, bun 1.1.17! With VPN it sends back:

ConnectionClosed: The socket connection was closed unexpectedly. For more information, pass verbose: true in the second argument to fetch()

yuhengliang commented 2 weeks ago

I also encountered this problem, when using vpn to access https at high frequency, the error "ConnectionClosed: The socket connection was closed unexpectedly. For more information, pass verbose: true in the second argument to fetch()”

Ubuntu 24.04 LTS (GNU/Linux 5.15.153.1-microsoft-standard-WSL2 x86_64) Bun 1.1.24