Fetch has built-in timeout support

"The AbortSignal.timeout() static method returns an AbortSignal that will automatically abort after a specified time."
await fetch(url, {
  signal: AbortSignal.timeout(5000),
});