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
- How to use dart workspaces to deploy a f...
Hello, I'm developing a Flutter application and I would like to leverage dart pub workspaces to deploy a function with a dart runtime as advertised here : http...
- Enabling Overage Usage
Hello Appwrite Support Team, I am currently using Appwrite under the GitHub Student Developer Pack plan. Recently, my project hit the database read limit, and ...
- appwrite-docs MCP fails in Cursor β SSE ...
Hi team, I'm having trouble getting the hosted Appwrite docs MCP working in Cursor on Windows. Environment IDE: Cursor (latest) OS: Windows 11 Node: v24.15.0 ...