- My goal: So I want to upload a csv and then run every item in that file through 2 API calls. I need the response from the first API before I call the next query
- Issue: When the API returns a 400, it always returns a undefined. It's not an error but undefined.
- Steps I've taken to troubleshoot:
- using async
for (const row of data_from_table) {
let apiResponseData = await provision_api.trigger({
additionalScope: {
id: row.id,
extra_data_1: row.extra_data_1,
}
});
// when we have a 400 returned from the API, apiResponseData is undefined.
// therefore this is an error
await save.trigger({
additionalScope: {
id: row.id
timestamp: new Date().toISOString(),
http_status_code: apiResponseData.http_status
}
});
}
- Promise.all
// map through every row of a csv file and call an API
return Promise.all(
data.map((row) => {
return provision_api.trigger({
additionalScope: {
id: row.id,
extra_data_1: row.extra_data_1,
}
});
}),
).then((results) => {
// results is undefined
console.log(results);
return results;
}).catch(error => {
// never hit
console.log('this');
});
- Additional info: (Cloud or Self-hosted, Screenshots)
I've tried changing the failure conditions, still only getting undefined.

Error from API.
