Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fetch API increase timeout

I want to increase the timeout (say to 10 mins) of the fetch API for one of my PATCH request.
So far I only found a way how to decrease it with here with AbortController Fetch API request timeout?

Is that something that browser has a full control of? Should I search for alternatives such as Axios or AJAX?

like image 710
Ren Avatar asked Jan 20 '26 05:01

Ren


1 Answers

You can’t increase a timeout for fetch because the Fetch API has no built-in timeout. It waits indefinitely unless you cancel it.

The only way to control timing is with AbortController.
Using Axios or AJAX doesn’t bypass this—Axios just wraps the same abort logic.

If a request needs several minutes, it’s better handled asynchronously on the backend (e.g., return 202 Accepted and poll for status).

like image 180
Akhila Lagishetty Avatar answered Jan 21 '26 17:01

Akhila Lagishetty



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!