ExactOnline API multiple requests failing on automation platforms like Zapier and n8n

I have a script that handles customer creation and updates using the ExactOnline API. The script works perfectly when I test it locally, but when I deploy it to automation platforms like Zapier or n8n, it stops working properly.

On Zapier, the execution halts right before making the fetch request. Here’s my implementation:

var authToken = 'bearer_token_here';
var companyDivision = 'division_id_here';

var customerInfo = {
  "Name": "business name",
  "City": "location",
  "Website": "example.com"
};

var personInfo = {
  "FirstName": "john",
  "LastName": "doe", 
  "City": "hometown"
};

var resultCustomerId;

async function processAction(actionType) {
  var currentAction = actionType;
  
  if (currentAction == "create_customer_and_contact") {
    var newCustomerResult = await createCustomer(customerInfo);
    var customerGuid = newCustomerResult;
    
    personInfo.Account = customerGuid;
    var newPersonResult = await createPerson(personInfo);
    var personGuid = newPersonResult;
    
    resultCustomerId = customerGuid;
    
    return ('contact creation successful');
  }

  async function createCustomer(customerData) {
    console.log('creating customer: ');
    
    var customerResponse = await makePostRequest(1, customerData);
    console.log('customer created: ' + JSON.stringify(customerResponse));
    
    return await customerResponse.d.ID;
  }

  async function createPerson(personData) {
    var personResponse = await makePostRequest(2, personData);
    console.log('person created: ' + JSON.stringify(personResponse));
    
    var updateData = {
      MainContact: personResponse.d.ID
    };
    
    var targetCustomerId = personData.Account;
    await modifyCustomer(updateData, targetCustomerId);
  }

  async function makePostRequest(requestType, payload) {
    console.log('making post request');
    
    var apiUrl = 'https://start.exactonline.nl/api/v1/' + companyDivision + '/crm/';
    
    if (requestType == 1) {
      apiUrl += 'Accounts';
    }
    if (requestType == 2) {
      apiUrl += 'Contacts';
    }
    
    var result;
    
    await fetch(apiUrl, {
      method: "POST",
      headers: {
        'Accept': 'application/json',
        'Authorization': 'Bearer ' + authToken,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(payload)
    }).then(response => {
      return response.json();
    }).then(jsonData => {
      result = jsonData;
    }).catch(error => {
      console.log(error);
    });
    
    return result;
  }

  async function modifyCustomer(updatePayload, customerId) {
    var updateUrl = 'https://start.exactonline.nl/api/v1/' + companyDivision + '/crm/';
    updateUrl += "Accounts(guid'" + customerId + "')";
    
    await fetch(updateUrl, {
      method: 'PUT',
      headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer ' + authToken
      },
      body: JSON.stringify(updatePayload)
    });
  }
}

async function executeProcess() {
  console.log("starting process");
  await processAction("create_customer_and_contact");
  return ("process completed");
};

output = [executeProcess()]

Has anyone encountered similar issues with ExactOnline API calls on these platforms? What could be causing the difference in behavior between local and cloud execution?

I hit this same issue integrating ExactOnline with automation platforms. It’s probably how these platforms handle async operations and timeouts. Your code uses async/await, but the final output assignment might not be waiting for the promise to resolve properly.

Wrap your executeProcess call in an IIFE and make sure you’re handling promises correctly. ExactOnline’s API is picky about request timing and headers - automation platforms sometimes strip or modify headers differently than your local setup.

The bearer token format trips people up too. Some platforms automatically URL-encode the authorization header, which breaks the Bearer token. Add more detailed logging around your fetch requests to see exactly where it’s failing on the platform vs locally.

This is probably a fetch API issue. Most automation platforms don’t support native fetch - they want you to use their own HTTP methods instead. Zapier has its own fetch object you should use, and n8n needs you to use their HTTP request node instead of JavaScript fetch calls.

Your async function structure might be causing problems too. Those nested functions inside processAction (createCustomer, createPerson, etc.) create scope issues that act weird in cloud environments. Move them outside processAction to avoid hoisting problems.

Also check your error handling. Your makePostRequest function catches errors but doesn’t pass them up, so failures get silently ignored on these platforms even though you’d see them locally.

sounds like a timeout problem. both zapier and n8n have execution limits that’ll kill your sequential api calls. add delays between requests or build in retry logic. also worth checking if they’re blocking certain domains - i’ve seen exactonline requests get blocked on automation platforms before.