nishp77
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
What's the exact error?
Recommended threads
- HTTP POST to function returning "No Appw...
Hi everyone, I’m running into an issue with my self-hosted Appwrite instance. I’ve set up my environment variables (APPWRITE_FUNCTION_PROJECT_ID, APPWRITE_FUNC...
- Can't add dart 3.5 runtime
Modified the `.env` to enable dart 3.5 runtime on my self-hosted instance but still can't find the runtime when creating a new function. I manually pulled the i...
- How to verify an user using AppWrite Fun...
I have seen similar questions but none whose solutions serve me. I have a function to verify a user with their secret and their id: https://blahblah.appwrite.gl...