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

334
Views
How to pinpoint root cause of sporadic XHR error 0 (Network Error)?

I run a SaaS, and we use LogRocket to monitor customers' screens so it's easier to troubleshoot issues when things go wrong. One issue that's been really elusive lately is an "error 0".

All that Sentry logs is "Network Error" which isn't helpful, and a 0 response from an XHR PATCH request. Here's what the API calls made from the customer's browser look like in LogRocket:

Screenshot of HTTP calls logged in LogRocket

This is what I find baffling: there are previous successful calls to the API (AWS API Gateway, by the way). And when I watch the user's screen at the time of that error, there's no kind of interruption such as a page reload, or the user closing the tab, which I think are typical reasons for error 0.

This is totally sporadic. I'm looking for any advice on how to find out what's causing this, because I'm at a loss here. Thanks!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If it's actually an abort that's causing this, this may help you capture it.

const trigger = document.getElementById("trigger");
const display = document.getElementById("display");
const toggle = document.getElementById("toggle");

const url = "https://api.coingecko.com/api/v3/exchanges?per_page=500";

trigger.addEventListener("click", sendRequest);

async function sendRequest() {
  const controller = new AbortController();
  const { signal } = controller;
  
  let timerId;
  
  if (toggle.checked) timerId = setTimeout(() => controller.abort(), 20);
  
  try {
    const response = await fetch(url, { signal });
    console.log(response);
    display.innerText = response.status;
  } catch (err) {
    console.log(err);
    display.innerText = err;
  }  
  
  if (timerId) clearTimeout(timerId);
}
<button id="trigger">Start</button>
<label for="toggle">Show abort</label><input type="checkbox" id="toggle" />
<div id="display"></div>

about 4 years ago · Juan Pablo Isaza Report
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!