Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

190
Vistas
Why are my forced GET errors occurring twice instead of once in the browser?

Is this expected? I am testing the error checking of my code by forcing a GET error. That is, I turned off the endpoints on purpose. Oddly I am getting two errors for each single error.

I verified my fetch() request only occurs once by logging it to the console.

However I see two errors in the console. I wanted to make sure that for some reason the browser is not fetching the data twice.

Is this expected behavior? If so where is it documented?

GET http://localhost:3000/users/user 404 (Not Found)

It occurs twice for a single fetch();

Here is the fetch()

const options = {
  credentials: 'include'
};
fetch('/users/user', options)
  .then((response) => {
    return response.json();
  })
  .then((user) => {
    if(user) {
      dispatch({type: 'initializeUser', current: user});
    }
  })
  .catch((err) => {
    console.error('DEBUG: F1Data: /users/user endpoint failed : ', err);
  })

Similarly, I see my own error being thrown twice as well:

DEBUG: F1Data: /users/user endpoint failed :  SyntaxError: Unexpected token < in JSON at position 0
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda