Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

175
Views
Failed browser "fetch" causes second unrelated fetch to fail

I've stumbled about a strange bug that I can't wrap my head around.

In an application I'm working on, due to an error, a fetch with a way to big URL was triggered. Because that fetch is so big it fails (414 - request entity too large).

All fine up to this point.

Now, due to a completely unrelated part of the application, a second fetch was made to the same API. Strangely this second, unrelated fetch fails too.

I created a minimal reproduction for it to find out what causes this weird behaviour. It turns out it only happens with the following criteria:

  • Second fetch must request the same API
  • Second fetch must happen in a certain time period (setTimeout with short delay also fails, but if you increase that value, at some point the issue disappears)

This behaviour seems to be reproducible on all major browsers. I used mainly chrome.

Code that illustrates issue:

import { useEffect, useState } from "react";

function App() {
  const [counter, setCounter] = useState(0);

  useEffect(() => {
    // way to big fetch
    fetch(
      "https://catfact.ninja/fact/failurefetch?long=INSERT_ABSURDLY_LONG_STRING_RIGH_HERE_THAT_REACHES_URL_LIMIT",
      { method: "GET" }
    ).then((res) => res.json());
  }, [counter]);
  useEffect(() => {
    // fails
    fetch("https://catfact.ninja/fact", { method: "GET" });
    // also fails
    setTimeout(() => {
      fetch("https://catfact.ninja/fact", { method: "GET" });
    }, 10);
    // works
    setTimeout(() => {
      fetch("https://catfact.ninja/fact", { method: "GET" });
    }, 1000);
  }, [counter]);

  return (
    <div
      className="App"
      onClick={() => {
        setCounter((prev) => prev + 1);
      }}
    >
      Refetch
    </div>
  );
}

export default App;

Reproduction codesandbox

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!