Do apps timeout?

Hi,

I am trying to fetch from a url, and in the meantime the app will crash:

# Unexpected error in app

An error occurred while trying to load this app.

* Refresh app

With no other error, is there any timeout on waiting for an update? Is there a way to increase the timeout or have the request happen in the background to not incur it?

Cheers,

B

import ForgeUI, { render, Fragment, Text, Button, IssuePanel, useState, Table, Head, Row, Cell } from '@forge/ui';
import api from '@forge/api';
import { useIssueProperty } from '@forge/ui-jira';

const getFixes = async (issueId) => {
  const res = await api.fetch('https://x.y.org/fixes?change=' + issueId);
  console.log(res)
  return res.json()
};


const App = () => {
  const [jobs, setJobs] = useIssueProperty("jobs", [2238765]);
  // const [result, setResult] = useState(async () => await getFixes(2238765));
  const [result, setResult] = useState({"Fixes": [{"Job": 'j1', "Status": "s1"}]});
 // This log happens the second time  but after the app has error'd, which leads me to think there is some timeout.
  console.log(result.Fixes)
  console.log(jobs[0])
  debugger;
  return (
    <Fragment> 
      <Text>{jobs[0]}</Text>
      <Text>{JSON.stringify(result)}</Text>
      <Button
        text="Update"
        onClick={() => {
          setResult((async () => {return await getFixes(jobs[0])})());
          //setResult({"Fixes": [{"Job": 'j2', "Status": "s2"}]});
        }} />
    </Fragment>
  );
};

export const run = render(
  <IssuePanel>
    <App />
  </IssuePanel>
);

Yes, apps timeout after 10 seconds. See invocation limits.

There isn’t currently any way to increase the timeout or background a request.

1 Like

Hi @BrettB,

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 10s (and the subsequent 25s) limit is now out of date, I’m closing this thread.

1 Like