oven-sh / bun

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

Inconsistent axios error behavior in bun #5643

Open ShlomoCode opened 1 year ago

ShlomoCode commented 1 year ago

What version of Bun is running?

1.0.2+37edd5a6e389265738e89265bcbdf2999cb81a49

What platform is your computer?

Darwin 22.6.0 arm64 arm

What steps can reproduce the bug?

  1. Install the axios library
  2. run this code:
    
    const axios = require('axios');

(async () => { const urls = [ 'https://www.microsoft.com/404', // server returns html with 404 status code. error is AxiosError 'https://eastus.stt.speech.microsoft.com' // server returns only 404 status code. error is ERR_TLS_CERT_ALTNAME_INVALID ];

for (const url of urls) {
    try {
        await axios.get(url);
    } catch (error) {
        console.error(url, error.name, error.message);
    }
}

})();



### What is the expected behavior?

The error should come from axios when the request fails

### What do you see instead?

In node.js both errors come from axios and they are "AxiosError Request faile with status code 404"
**In bun**, the error in the second address, which does not return an answer but only an error code status, an error is received "`ERR_TLS_CERT_ALTNAME_INVALID fetch() failed. For more information, pass `verbose: true` in the second argument to fetch()`"

### Additional information

https://github.com/oven-sh/bun/assets/78599753/6e89bc74-8c42-4bd7-87fb-3d5e76accc44

I would be happy to provide any additional details needed
Zikama commented 1 year ago

Facing same issue fetch() failed. For more information, pass `verbose: true` in the second argument to fetch()

Jarred-Sumner commented 11 months ago

i'm unable to reproduce this

image
sonu628 commented 10 months ago

@Jarred-Sumner I got the same, seems like the issue was either resolved in a newer version or was due to user's specifications

devHaitham481 commented 10 months ago

did this get resolved ? i'm getting the same error

grmkris commented 9 months ago

same here

nospher3x2 commented 8 months ago

same here

1cedsoda commented 7 months ago

I also can't reproduce in 1.1.0+5903a6141

kyjus25 commented 6 months ago

+1

devcaeg commented 6 months ago

+1