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.What's the exact error?
Recommended threads
- Unable to create Sites or Functions with...
Heya, I was looking at the appwrite documentation for Sites API with the server api: https://appwrite.io/docs/references/cloud/server-nodejs/sites I can’t fin...
- Triggers and call function in function p...
Hello, Today we are experiencing several issues with Appwrite Cloud. Functions triggered by events, or functions called from another function, are taking an e...
- Functions executed by events does not ap...
Hello, Running self-hosted Appwrite version 1.9.0 (with console 7.8.26). When functions are triggered by an event (eg. databases.\*tables.\*.rows.\*.create) doe...