API Timeout Issues

I have an API call posted below that takes about 3 minutes serverside to complete. It times out around the 2 minute mark so when I return the data it already is timed out. Is there something in the code wrong or is there a way to utilize a different method?

f

d.rendered(function() {
  fd.clear();
  const queryString = window.location.search;
  const urlParams = new URLSearchParams(queryString);
  $('.remove').hide();
$('.hidden').hide();
fd.field('User').value=urlParams.get('user');
var url = "https://prod-02.eastus.logic.azure.com:443/workflows/...";

var body = {
  Type: "UserInfo",
  Data1: urlParams.get('user'),
  Data2: "groups"
};

var timeoutDuration = 240000; // Timeout duration in milliseconds (4 minutes)

var controller = new AbortController();
var signal = controller.signal;

var timeoutId = setTimeout(() => {
  controller.abort(); // Abort the request when the timeout is reached
  console.log('Request timed out');
}, timeoutDuration);

fetch(url, {
  method: 'POST',
  body: JSON.stringify(body),
  headers: {
    'Content-Type': 'application/json'
  },
  signal: signal // Pass the signal to the fetch call
})
  .then((response) => response.json())
  .then((data) => {
    clearTimeout(timeoutId); // Clear the timeout when the response is received
    console.log('Response JSON:', data);
    var choices = data.ResultSets.Table1.map((item) => item.Name);
    console.log(choices);
    fd.field('Groups').options = choices;
    if (choices.includes('None')) {
      $('.remove').show();
      $('.none').hide();
      fd.control('HTML2').html = '<p><strong>You have no approved groups to remove.</strong></p>';
      $('.hide').hide();
    } else {
      $('.remove').show();
      fd.control('HTML2').html = '<p><strong>Select the groups you wish to remove.</strong></p>';
      $('.none').show();
      $('.hide').hide();
    }
  })
  .catch((error) => {
    clearTimeout(timeoutId); // Clear the timeout in case of an error
    console.log('Error:', error);
  });

});

Dear @IT.Joe,
What exactly are you trying to do with the API? How long is the response time if you send a direct request outside of the form?

You can always change the timeoutDuration, but if the API is taking several minutes to respond it might be better to re-configure the API.

API calls a Logic App which runs an automation service. The reason it takes what it takes is the Runbook uses PowerShell to collect a User's shared mailboxes and Distribution Groups from our active directory. It takes an average of 2 minutes and 30 seconds to run and it seems no matter what timeout setting (4 minutes currently) it still returns a timeout after 2 minutes on the response.

Dear @IT.Joe,
Unfortunately, that would be beyond our knowledge, I would recommend checking in with the communities dedicated to Logic Apps and PowerShell, we're more than happy to help with the forms integration though!

It's the form connection to the API that is timing out but that's ok. I will find a different approach outside of a plumsail form.