https://retellai.com/?utm_source=discord&utm_medium=seo logo
Function calling not working (Urgent)
# ❓・bug-report
s
Hi, I have a Firebase cloud function that works but when my Retell agent tries to call it (I verified it passes proper body in the request), my function keeps printing "undefined" as the body. This tells me that the Retell agent is not able to properly call my function with the body even though it is getting the body right. Has anything changed recently? This is affecting our ability to go to production with Retell.
My function code:
Copy code
export const executeQuery = functions.https.onRequest(async (req: Request, res: Response): Promise<void> => {
  corsHandler(req, res, async () => {
    if (req.method !== "POST") {
        res.status(405).send({ error: "Method not allowed" });
        return;
    }

    const prompt: DatabaseQueryRequest = req.body;

    if (!prompt || !prompt.prompt || !prompt.userId) {
        res.status(400).send({ error: "Missing or incomplete prompt" });
        return;
    }
Tool log:
Copy code
tool_call_id: call_Td9GeM1LxYyrHjqnkuz8KqMc

{ "prompt": "example", "userId": "999999", "execution_message": "Sure! Just give me a couple seconds." }
result:
Copy code
tool_call_id: call_Td9GeM1LxYyrHjqnkuz8KqMc

{"error":"Missing or incomplete prompt"}
It seems like it is giving me undefined.. Please help.
this is my JSON schema:
Copy code
{
  "type": "object",
  "properties": {
    "prompt": {
      "type": "string",
      "description": "The explicit natural language execution statement to ask the database to do."
    },
    "userId": {
      "type": "string",
      "description": "The userId of your current user"
    }
  },
  "required": [
    "prompt",
    "userId"
  ]
}
I FIXED IT: use req.body.args NOT req.body