I am building the Jira forge app.
I am trying to fetch the details from the 3rd party API and the API response contains more than 1000 records. And with that data, I need to create the Jira issues. All that process takes more than 25 seconds to complete.
I tried to use Async Events API to make that happen in the background without getting the error of “Unexpected error in app”, but it also does not complete the process of creating the issues. It only creates some of the issues.
How can I fetch all responses and create it issues when I sync the app and create the tickets by overcoming the 25 seconds limitation for the invocation?
As a sanity check, have you limited the number of async events to just 50?
There is a limit to the number of async calls a single invocation can produce mentioned here.
I’d recommend taking the records and splitting them evenly across 50 events. Those 50 events could then create more events, splitting the lists even further. Eventually there will be async events with a manageable amount of records to create Jira tickets, these will work with the 25s time limit.
Alternatively, instead of putting the burden on a lot of individual developers to engineer around an arbitrary timeout, Atlassian could also increase the invocation limit?
I mean, AWS Lambda has a timeout of 15 minutes (since 2018, that is 4 years ago, and before that it was 5 minutes) and GCP Cloud Functions can even run up to 60 minutes
There is no technical reason for 25 seconds invocation timeout. If it’s cost related, I’m sure there are plenty of developers that rather pay per invocation than spent time on building around archaic limits.
If Forge is using API Gateway in order to call the functions, the timeout limit seems to be 29 seconds. So I guess this explains the 25 seconds
If that would be the case, that would be an extremely interesting (read: weird) architectural choice for async event handling.