Fetch error when calling multiple fetches to build static site

Hi guys, I’m new to strapi but keep getting a

    at async file:///vercel/path0/dist/chunks/prerender_z0pSUssE.mjs:614:21
    at async Object.render (file:///vercel/path0/dist/chunks/astro_4VOd5ehm.mjs:1572:7)
    at async Object.renderToFinalDestination (file:///vercel/path0/dist/chunks/astro_4VOd5ehm.mjs:866:7)
    at async renderChild (file:///vercel/path0/dist/chunks/astro_4VOd5ehm.mjs:1059:5)
  Caused by:
  other side closed
    at TLSSocket.onSocketEnd (node:internal/deps/undici/undici:7998:26)
    at endReadableNT (node:internal/streams/readable:1368:12)
Error: Command "npm run build" exited with 1

It only happens occasionally and if I reploy a few times it works eventually, so I’m guessing it’s not a code error.