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

157
Visualizações
timeoutSignal not working with node-fetch server side

I am trying to upgrade my node-fetch with the instructions here: https://github.com/node-fetch/node-fetch/blob/HEAD/docs/v3-UPGRADE-GUIDE.md

I am able to get it to work and return a result when I don't set the signal option. I am not able to get the timeout working using timeoutSignal. https://github.com/node-fetch/timeout-signal

    
    const signal = timeoutSignal(5000); // This returns and empty AbortSignal object

    // setting this causes an error, the fetch works without it
    _.set(
      opts,
      'signal',
      signal
    );

    const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));

    fetchedResponse = await fetch(url, opts)
      .then(response => {
        console.log(response);
        return response;
      })
      .catch(error => {
        console.log(error);
      })

If I change the property name 'signal' to anything else like 'signal-disable' or just remove it, everything works (without a timeout). The issue is that 'timeoutSignal(5000)' is returning an empty 'AbortSignal' object.

In the examples that I see, timeoutSignal seems to be always used in a client side scenario. I am not sure if this will work server side and can't find any examples.

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