Missing Abort Controller
Fetch/axios calls without timeout or AbortController
infoPerformance
missing-abort-controllerWhy this matters
A fetch without a timeout hangs indefinitely if the remote server is slow or down. Your API route blocks, the connection pool fills up, and your entire server becomes unresponsive.
✗ Bad
const res = await fetch("https://api.example.com/data");
const data = await res.json();✓ Good
const controller = new AbortController();
const timeout = setTimeout(
() => controller.abort(), 5000
);
try {
const res = await fetch("https://api.example.com/data", {
signal: controller.signal,
});
const data = await res.json();
} finally {
clearTimeout(timeout);
}How to fix
Add an AbortController with a timeout to every external fetch call. 5-10 seconds is reasonable for most APIs.