Back

execution time out

  • 0
  • Functions
nishp77
12 Apr, 2024, 18:51
TypeScript
export default async ({ req, res, log, error }) => {
 try {
    const client = new Client();
    const database = new Databases(client);

    setupAppwrite(client);

    const payload = JSON.parse(req.body);
    const driverStatus = payload.status;

    if (driverStatus === STATUS_ARRIVED || driverStatus === STATUS_COMPLETED) {
      const customerDeviceToken = await getCustomerDeviceToken(
        database,
        payload.cId
      );

      await sendNotification(
        customerDeviceToken,
        getNotificationMessage(driverStatus)
      );
    }

    await updateDriverStatus(database, payload);

    return res.send("Ride status updated", 200);
  } catch (err) {
    error("An error occurred:", err);
    return res.send("An error occurred.", 500);
  }
};

Could anyone help me out on what's wrong?

TL;DR
The error occurring is a timeout during the execution of the code provided. This could be due to issues with database operations or network delays. Consider optimizing database queries and network calls for faster processing.
Evdog
12 Apr, 2024, 19:00

What's the exact error?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more