Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

193
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda