Skip to main content

Script with consecutive remoteFetchAsync call failing

  • January 22, 2025
  • 1 reply
  • 16 views

Forum|alt.badge.img+4

Seems to be working fine previously but now when I am making consecutive calls with remoteFetchAsync, I get `TypeError: Failed to fetch` after the 1st, 2nd or 3rd request.

Is there a change in behaviour in a recent release?

 

Code example:

```

for (let invoice of requests) {
  let response = await remoteFetchAsync(ENDPOINT_URI, {
  method: 'POST',
  body: JSON.stringify({ 'invoices': [invoice] }),
  headers: {
    "Content-Type": "application/json",
    "Accept": "application/json",
  },
});
// Wait for 0.2 seconds before the next iteration
await sleep(200);
}

```

1 reply

Forum|alt.badge.img+1
  • New Participant
  • January 23, 2025

Your requests might be timing out. Check if the server, like at OsteoPilates Studio in Ivrea, can handle multiple consecutive calls.