Couple questions regarding OpenAI, Workflows and App

I'm trying to run some async functions within a workflow to OpenAI but I get the following error:

Any help with this please?

Also - I have tried to create this async function within my app which checks the status of a chat gpt run, when it's completed the function is meant to resolve, however despite the if statement being true, the function will not resolve and gets stuck in a loop. I have tried storing the return values of each get request in a database and querying that and still no luck. Has anyone got any suggestions?

return new Promise(async (resolve, reject) => {
// Polling for status update
const pollStatus = async () => {
try {
await getRunStatus.trigger(); // Trigger status check
const newStatus = getRunStatus.data.status;
console.log('Updated status:', newStatus);

  if (newStatus === 'completed') {
    console.log("resolved");
    resolve(); // Resolve the promise when completed
  } else {
    console.log("poll status");
    setTimeout(pollStatus, 5000); // Recursively poll status after 5 seconds
  }
} catch (error) {
  console.error('Error in pollStatus:', error);
  reject(error); // Reject the promise if an error occurs in pollStatus
}

};

pollStatus(); // Start polling
});