I have a function that loops through documents to check to check their expiredDate . It results to error when I run the function triggered by a cron job.
An internal curl error has occurred within the executor! Error Number: 104. Error Msg: Connection reset by peer\nError Code: 500
It runs fine when I remove the while loop. Here's the code
while (products.total > 0) {
for (const product of products.documents) {
if (new Date(product.expiryDate) < new Date()) {
await db.createDocument("drug-inventory", "notification", ID.unique(), {
type: "expired-drug",
isAdmin: false,
product: product.$id,
expiredDate: product.expiryDate,
});
}
}
offset += 50;
products = await db.listDocuments("drug-inventory", "products", [
Query.limit(50),
Query.offset(offset),
]);
}
How long does it run before this happens?
1 - 3 seconds
And it happens every time?
yes, everytime
Recommended threads
- ClientException with SocketException: Cl...
hi <@564158268319203348> i have noticed this 500 status code in my function requests, it seems its not able to connect to the internet in the function as reque...
- NEW ERROR Invalid document structure: At...
Error: ```AppwriteException: document_invalid_structure, Invalid document structure: Attribute "pb.kmsgxPkgInfo.id_info" must be an array (400)``` I’m encounter...
- Issues with executor in Appwrite 1.9.0
Hi, I’ve recently did a fresh install of appwrite 1.9.0 self hosted and when I run a function, it just waits indefinite This is the error from the log: [Er...