Forge asyn call timeout

Hi
We are calling ChatGPT api from forge as Asyc call and it has time out at 25 secs. And some time ChatGPT takes longer. Is there any way to increase forge time out? Or any other work around?

Thanks. Appreciate your help.

Hi @SushilBhattachan ,

There is no way to increase the execution time of a Forge function. My suggestion is to invoke the API such that you get back some kind of job ID that you can check the status of in async tasks until it is complete. This is a common pattern for queries that may take a long time. If the ChatGPT API doesn’t support this, you may need to create a service of your own that acts as a facade.

Regards,
Dugald

2 Likes

Oh. I see. Umm. Not sure. Let’s see.

Hi @dmorrow ,

I have the same issue with the timeout at 25 secs.
Read your reply about using the job ID to check the status of async task, do you have any example on how to do this?

Thanks.

Regards,
Benny.

Hi @BennyChandra ,

The Redash API is an example of an API that provides job IDs in response to queries because Redash queries can take a long time to execute.

I don’t have any example code, but your app could perform the following steps:

  1. Invoke the query API and parse the Job ID from the response.
  2. Invoke the API to get the status of the job, passing in the Job ID.
  3. If the status in the response indicates the job is complete, invoke the API to get the job results.
  4. If the status in the response indicates the job is incomplete, schedule a retry using the Forge Async events API, passing the Job ID as a context parameter so it is available when performing the retry.

Regards,
Dugald

1 Like

@dmorrow @HeyJoe Thanks for your response.

  1. We are good on how to call external API
  2. We got the job id
  3. Now we want external API to call back using Forge Web trigger- so we are struggling to find some example of how to setup web trigger and how to call it from external API.

Any documentation or example would be very helpful.

Hi @SushilBhattachan ,

To understand Forge webtriggers, you might like to try to create a new app using the webtrigger template and examine the generated code. To get the app up an running, you can do the following:

  1. Deploy the app with forge deploy.
  2. Install the app with forge install.
  3. Show the installation ID with forge install list.
  4. Copy the installation ID to your clipboard.
  5. Run forge webtrigger and choose either of the webtriggers of the app (sync or async).
  6. Copy the URL returned and perform a GET on it. e.g. enter it into a browser.

Regards,
Dugald

1 Like

Hi @SushilBhattachan and @BennyChandra,

As an update on this topic, we’ve recently announced an increase in the runtime limit for async event invocations from 25 seconds to 55 seconds. Please see my colleague @dmorrow’s example app to explain how to take advantage of this increased limit.

Since the 25s limit is now out of date, I’m closing this thread.

2 Likes