Error with V3 List API

Hi @cpradalier
Yeah I found a solution (if you can call it that) by using the Axios library. Feel free to use the below as a starting point to resolving your issue, and let me know if you have any questions :+1:

const axios = require('axios');

exports.main = async (event, callback) => {

 let toObjectIds = event.inputFields['toObjectIds']; // in this example, we're pulling in an array of data from a previous step, for comparison, but adjust this to your needs
 toObjectIds = JSON.parse(event.inputFields['toObjectIds']); 

 const hubspotApiKey = << put your secret here >>;
 const listId = 1111; // this represents the list you're targeting

 const options = {
 method: 'GET',
 url: `https://api.hubapi.com/crm/v3/lists/${listId}/memberships`,
 headers: {
 Authorization: `Bearer ${hubspotApiKey}` 
 }
 };

 let responseData = null;
 let recordIds = [];

 try {
 const response = await axios(options);
 responseData = response.data;
 console.log(responseData);

 recordIds = responseData.results.map(item => item.recordId); // In this example I'm mapping the returned data to an array, but you don't necesserily have to do this. If you don't, it'll simply return as a string literal. 

 } catch (error) {
 console.error('Error:', error);
 throw error
 }

 callback({
 outputFields: {
 responseData: JSON.stringify(responseData)
 }
 });
};