Fetch function for ExactOnline with multiple request error on zapier and n8n

I’ve been working on a script that creates and updates stuff with the ExactOnline API.

when I run the script locally everything works fine but when I try to use it on a platform such as Zapier or n8n it doesn’t work as intended.

on Zapier it only runs just before it does a fetch request

this my code that I use in zapier:

var token = 'token';
var divisionid = 'divisionid';

var AMRelatieData = {
  "Name": "company name",
  "City": "city name",
  "Website": "website.com"
};


var AMContactData = {
  "FirstName": "firstname",
  "LastName": "lastname", 
  "City": "name city"
};
var testrlid;

async function actionHandeler(actionValue) {

  var action = actionValue;
  if (action == "cp_maken_&_relatie_maken") { 

    var maakRelatieWaarde = await maakRelatie(AMRelatieData);

      var POSTrelatieID = maakRelatieWaarde;

      AMContactData.Account = POSTrelatieID;

      var maakContactwaarde = await maakContact(AMContactData);
        var POSTcontactID = maakContactwaarde;

        testcpid = POSTcontactID;
        testrlid = POSTrelatieID;

  return ('maakContactwaarde succes');

  }

  //functions
  async function updateRelatie(updateData, relatieId) {

    var UpdateRelatiePUT = await PUTreq(1, updateData, relatieId);

    console.log(UpdateRelatiePUT);

    return ("updateRelatie succes");
  }

  async function maakRelatie(createData) {
    var relatieId;

    console.log('maakRelatie: ');

    var maakRelatiePOST = await POSTreq(1, createData); 

    console.log('maakRelatieFunc:' + JSON.stringify(maakRelatiePOST));

    return await maakRelatiePOST.d.ID;
  }

  async function maakContact(createData) {
    var contactId;


    var maaktcontactPOST = await POSTreq(2, createData);

    console.log('maaktcontactFunc:' + JSON.stringify(maaktcontactPOST));


    var jsonData = {
      MainContact: maaktcontactPOST.d.ID
    };

    var relatieIdUpdate = createData.Account;
    await updateRelatie(jsonData, relatieIdUpdate);
  }

  async function POSTreq(type, DATA) {
    console.log('postreq');

    var POSTendpoint = 'https://start.exactonline.nl/api/v1/'+ divisionid +'/crm/';
    if (type == 1) {

      POSTendpoint += 'Accounts';
    }
    if (type == 2) {

      POSTendpoint += 'Contacts';
    }

    var outputPOST;
    console.log(DATA);
    await fetch(POSTendpoint, {
      method: "POST",
      headers: {
        'Accept': 'application/json',
        'Authorization': 'Bearer ' + token,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(DATA)
    }).then(response => {
      return response.json();
    }).then(jsonResponse => {
      var responseOut = jsonResponse;
      outputPOST = responseOut;
    }).catch(error => {
      console.log(error);
    });
    return outputPOST;
  }

  async function PUTreq(type, DATA, id) {
    var PUTendpoint = 'https://start.exactonline.nl/api/v1/'+ divisionid +'/crm/';

    console.log('put data');
    console.log(id);
    console.log('data' + DATA);
    console.log(type);

    if (type == 1) {
      PUTendpoint += "Accounts(guid'" + id + "')";
    }
    if (type == 2) {
      PUTendpoint += "Contacts(guid'" + id + "')";
    }

    console.log(PUTendpoint);
    console.log(PUTendpoint);
    await fetch(PUTendpoint, {
      method: 'PUT',
      headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer ' + token
      },
      body: JSON.stringify(DATA)
    });
  }
}


async function actionHandlerFunc(){
  console.log("begin");
  await actionHandeler("cp_maken_&_relatie_maken");

  return ("done did sum stuff");
};



output = [actionHandlerFunc()]