
I have a simple function that logs the body text. The body is some simple JSON which I am including in the POST dialog on the appwrite console for executing the function. The log statements return undefined.
module.exports = async function (context) { try { console.log(context.req.bodyText); console.log(context.req.bodyJson);
TypeScript
} catch (error) {
console.error("Error:", error.message);
}
return {};
};
TL;DR
Issue: The function is logging undefined for context.req.bodyText and context.req.bodyJson when it should be logging the JSON body text.
Solution: Change context.req.bodyText to context.body. This should correctly log the body text.
Can you send a picture of the dialog?
Recommended threads
- Network error when attempting to fetch r...
Hi, I am trying to modify some database data in the console for testing but keep getting this error. I am on the appwrite cloud and have already tried clearing ...
- Having errors migrating to cloud
Project will not migrate compeltely
- Appwrite realtime stopped working all of...
In our production environment, Appwrite Realtime suddenly stopped working and no updates are coming through , can you confirm if there are any known issues?
