Handling function timeouts in Atlassian Forge - Any solutions?

@rick.van.twillert,

  1. Is it true that function timeouts in Forge can’t be caught or handled?

I confirm they are not available to your code as exceptions. You would see INVOCATION_FAILED in logs.

  1. If yes, how are you all dealing with this? Are there any best practices or workarounds that you’d recommend for handling these timeouts more gracefully?

From my experience, most apps aren’t running into the timeouts. But, there does seem to be a special case of “long calls” for AI. ChatGPT and friends often timeout.

  1. If timeouts can be caught, could you share some code snippets or point me towards the right resources where I can learn to implement this?

I think you can use Node’s setTimeout to help guard against long calls. I’m pretty sure the following will work in any Forge invocation context (not just Forge UI):