I'm having some issus using axios.all

Hello,

Can some share a node js code using axios.all ?

Mine is getting the following error:

This step was still trying to run code when the step ended. Make sure you promisify callback functions and await all Promises. (Reason: GetAddrInfoReqWrap, Learn more: https://pipedream.com/docs/workflows/steps/code/async)

My code:

import axios from "axios";

let data = params.data;

let configs = [];

data.forEach((event) => {
  
  let config = {
    method: 'post',
    url: 'myurl',
    data: {
      "id": event.id
    }
  };

  configs.push(config)
})

await axios.all(configs.map((config) => axios(config))).then(
  (data) => console.log(data),
);```

Hi @matthias

First off, welcome to the Pipedream community. Happy to have you!

Axios has deprecated the axios.all function and instead recommends to use a Promise.all instead:

So changing your code to this instead might fix the issue:

import axios from "axios";

    let data = params.data;
    
    const reqs = data.map((event) => {
      return axios.post('myurl', {
        data: {
          "id": event.id
        }
      })
    });

  await Promise.all(reqs);
})

Thanks a lot,

I’m going to test that asap !