Please someone. I am dying. how is true not a valid boolean here???
(NOBRIDGE) ERROR Error calling Appwrite function: [AppwriteException: Invalid async param: Value must be a valid boolean]
const response = await functions.createExecution( "FUNCTION_ID", JSON.stringify({ images: processedImages }), { async: true }, { headers: { 'Content-Type': 'application/json' } } );
Can you try passing just true instead of an object?
const response = await functions.createExecution( "FUNCTION_ID", JSON.stringify({ images: processedImages }), async=true, { headers: { 'Content-Type': 'application/json' } } );
like that?
No, just true
Like how you passed just the function id
that stopped that error but now I think it thinks the headers is the path param
Because it is 😜 order matters.
Do you have to fill out all the params if you want to specify the content-type? The whole reason I am doing this is because it isn't recognizing my json and just sending as plain-text I think
then on my back end, when I try to get the req.payload it is undefined
req.payload doesn't exist 🧐
Are there examples of this? I don't even know what I would put for the other params
@param xpath
@param method
and yeah when I try to log it, it is just undefined. I have been stumped for hours@
!
Because it's never defined. That doesn't exist. Don't know where you saw that it does exist
Path, like /. Method like GET. Or pass undefined.
https://appwrite.io/docs/references/cloud/client-web/functions#createExecution
omg wait haha so req.payload isn't even a thing??? I should be doing req.bodyJson
was trying to do this in my function
module.exports = async function (req, context) { try { console.log("Function execution started."); console.log("Received payload:", req.payload);
// Parse and log the payload
let images;
try {
const parsedPayload = req.payload ? JSON.parse(req.payload) : {};
images = parsedPayload.images || []; // Default to empty array if images is missing
console.log("Parsed payload successfully:", parsedPayload);
} catch (parseError) {
console.log("Failed to parse payload:", req.payload, parseError);
return context.res.json({
error: "Invalid payload. Ensure it is valid JSON with an 'images' array."
});
}
If you're passing application/json for the Content-Type header. Otherwise, use bodyText and convert using JSON.parse()
Recommended threads
- Local Serverless Function Testing: Are D...
I have followed the instructions to get the CLI working, and have been able to log-in, initialize my project, and created a simple Python function, which calls ...
- Update user email using OTP
Hi, I am trying to implement email update using OTP, there is not password associated with the account. One solution I found online is creating appwrite functio...
- Magic Link token automatically consumed
Hi, I'm using the Magic Link auth system with Appwrite Cloud and I'm running into huge issues getting users to log in successfully. About 9 times out of 10, th...