When am trying to make a call to openAI API with await properly added .. if there is no response even for 20 seconds GCP invoking the function multiple times and this is spamming the users.
any help on how to avoid this will be helpful and much appreciated
async function callFunction (userPrompt) { return new Promise( async (resolve, reject) => { try { **post this GCP function does not throw error, but keeps calling new instance of the function** var response = await xxxxx({ }); resolve(Output) } catch (error) { console.error(error) console.log("encountered error , initiate reject") reject(failedMessage) } });
How you are triggering cloud function, is https or pubsub triggered cloud function?
Triggering as https cloud function, tried various forums still no luck.. any help is much appreciated