Process execution stopped due to timeout

This is my onAppInstallCallback

onAppInstallCallback: async function (payload) {
    try {
      const appInstallHandler = new AppInstallHandler();
      console.log(
        '\n\n================= App install event Called =================\n'
      );
      await appInstallHandler.installationDebugLogs(payload);
      await appInstallHandler.handleCallback(payload);

      console.log('App install finished: ', new Date().toString());

      renderData();
    } catch (error) {
      console.log('err====', error);
      renderData({ error: error.message });
    }
  }

And this is await appInstallHandler.handleCallback(payload)

async handleCallback(payload) {
    const schedular = new ScheduleHandler();
    const storeResponse = await schedular.createSchedule();

    this.handleOneTimeSync(payload)
      .then(() => {
        console.log(`******* Process executed successfully *******`);
      })
      .catch((error) => console.log('Error: ', error))
      .finally(() => console.log('Completed'));

    return storeResponse;
  }

Here, handleOneTimeSync will take time to complete its execution which sometimes might be greater than 20 second timeout limit.

Since I am using the then... catch... block for this method. After scheduling the event, execution will not wait for handlerOneTimeSync and return a response directly before 20 seconds to the appInstallHandler and that console.log('App install finished: ', new Date().toString()); also logging and rednerData() will execute.

But since it takes time to complete handleOneTimeSync at the time of app installation and the App couldn’t be installed and timeout exceeds.

So, If I returned something before the timeout and did not wait for some async method which running using then…catch… , then also is the timeout affect it and the process stops after 20 seconds?

Is there any option that we can increase the timeout limit for some particular event?

Can anyone help me out of this?

@Parth_Shah,
Good day!
Unfortunately, it is not possible to increase the timeout,
instead of adding await :point_down: try to remove await and check.

const storeResponse =  schedular.createSchedule();

@Santhosh Good day!

schedular.createSchedule(); just creating the scheduling event and it might take a max of 1-2 seconds.

From the above log’s screenshot, I think, This problem occurs due to a timeout limit because as per the screenshot, the execution of the process has been stopped after 20 seconds. So If we don’t wait for any process by then...catch then also it stops after 20 seconds.

So according to my requirement sometimes the process will take time than 20 seconds.

I have found a similar issue: Find which scheduled event triggered a function in recurring schedule

So also in my scenario, using the standalone hosted server is the best approach to complete the execution without the platform’s timeout limit. Right?

Please provide your feedback.

Thank you.

yes, correct, you can use the standalone hosted server and call that API from our serverless event instead of scheduled events.

Hope it helps

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.