Skip to content
Back

Subject: Function req.body Empty Despite Successful cURL Request (Cloud Instance)

  • 1
  • Cloud
<khaltech/>
17 Jun, 2025, 16:19

Hi Appwrite Support Team,

I'm encountering a persistent issue where my Appwrite function is receiving an empty req.body, even though my cURL requests successfully send a JSON payload and receive a 201 Created response from the Appwrite API.

I've thoroughly debugged this, confirming that:

My cURL command correctly includes the JSON --data payload and Content-Type: application/json header. The Appwrite API responds with 201 Created, indicating successful receipt of the request and initiation of the function. My function's code explicitly checks typeof req.body (which logs as 'string') and attempts JSON.parse(req.body), but the req.body string itself is always empty within the function's execution environment. I have removed the X-Appwrite-Endpoint header from my requests, which was identified as a potential conflict, but the issue persists. It appears the request body is being lost or stripped between the Appwrite API gateway (which correctly processes the request) and the function's execution environment.

I have the following IDs available to share privately if required for investigation:

Appwrite Cloud Project ID Function ID

TL;DR
Issue: Despite successful cURL request and API response, function receives empty req.body. - cURL request includes JSON payload and receives 201 Created response. - Function checks req.body type as 'string' and tries JSON.parse, but req.body remains empty. - Removed X-Appwrite-Endpoint header, but problem persists. Solution: The request body may be lost between Appwrite API gateway and function environment. It's recommended to double-check the communication flow between the gateway and the function for any potential data loss or stripping mechanisms. Share Project ID and Function ID if further investigation is needed.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more