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

338
Visualizações
error UNHANDLED REJECTION ENOENT: no such file or directory, open '/vercel/path0/.cache/json/

I m running a fetch request inside of a for loop, the API I'm fetching it's a heroku server that scrapes data and sends it back with res.json(). The heroku server is a free version. The code failing in the gatsby-node (async createPages) is shown down below


const laro = await graphql(`{
 links {
  results 
  }
}
`)

await laro.data.links.results.forEach( async kok => {
   try {
   let luca = await kok.split("/")[4]
   let rollot = await fetch(
   `https://sheltered-meadow-66603.herokuapp.com/noti/${luca}`)

 await createPage({
 path: `/${luca}/`,
 component: abruNews,
 context: {
 data: rollot,
 },
})
} catch (err) {
  console.log(err)
}
})

the error I'm getting is this

For more info and debugging tips: see https://gatsby.dev/sync-actions
File /vercel/path0/gatsby-node.js:232:14
230 | )
231 |
> 232 | return createPage({
| ^
233 | path: `/${luca}/`,
234 | component: abruNews,
235 | context: {
success Building production JavaScript and CSS bundles - 48.439s
success Rewriting compilation hashes - 0.001s
error UNHANDLED REJECTION ENOENT: no such file or directory, open '/vercel/path0/.cache/json/_abruzzo-esperienziale-un-viaggio-nei-cinque-sensi-nelle-terre-dei-briganti_.json'
Error: ENOENT: no such file or directory, open '/vercel/path0/.cache/json/_abr uzzo-esperienziale-un-viaggio-nei-cinque-sensi-nelle-terre-dei-briganti_.json'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gatsby-starter-default@0.1.0 build: `gatsby build`
npm ERR! Exit status 1
npm ERR!

Thanks if you can help

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

A for loop (instead of a forEach) seems to be better ending every request and the error disappeared

about 4 years ago · Juan Pablo Isaza Relatório
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