Description
What version of Bun is running?
1.2.2+c1708ea6a
What platform is your computer?
Darwin 24.3.0 arm64 arm
What steps can reproduce the bug?
Hello Developer,
my fetch method to the endpoint "https://sandbox.finapi.io/api/v2/oauth/token"
does not return anything, no response, no error when Bun.serve is executed. Other methods functions work though. On windows it does work. Now, If I comment out the Bun.serve part, then and only then the fetch does response with what is expected from the endpoint.
I thing the only response I get is if idle times out.
const server = Bun.serve({
port: 5555,
async fetch(req) {
return new Response("ok", {
status: 200,
statusText: "test",
});
},
});
console.log(`HTTPS Proxy running on port ${server.port}`);
const t = performance.now();
setInterval(() => console.log(new Date()), 10_000);
// does not work, no response
fetch("https://sandbox.finapi.io/api/v2/oauth/token", {
method: "POST",
body: "just test for now",
})
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error))
.finally(() => {
console.log(performance.now() - t, "ms");
});
// does work
fetch("https://swapi.dev/api/")
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
// does work
fetch("https://echo.free.beeceptor.com")
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
// does work
fetch("https://echo.free.beeceptor.com", {
method: "POST",
})
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
What is the expected behavior?
fetch request to https://sandbox.finapi.io/api/v2/oauth/token
should return something
What do you see instead?
the request to https://sandbox.finapi.io/api/v2/oauth/token
does not return anything and hangs until idle timeout. on windows it does not happen on mac, it does.
the other api calls are not effected and do return a response.
Additional information
Using Postman on same machine works.
If I do somthing wrong, please let me know. I already spend quite a. lot of time, try to debug,
Update:
I do get a response after 225 seconds. Its the same response I get, when I comment out bun.serve.
It seems, that the requests goes through and hangs somewhere in the http server and gets released when something timed out.
Update 2
same behavoir with bun 1.2.3-canary.138+dc5fae461
Activity