
When I execute a NodeJS function via the Cloud console, I get this request header: "content-type":"application/x-www-form-urlencoded"
This breaks things since my code is expecting a JSON payload.
So I manually set the content type to application/json
with the Headers field shown in the screenshot. When this runs, it fails in 1-3 ms and there are no errors whatsoever to troubleshoot (see screenshot).
I've tried variations of this input such as "Content-Type"
content-type
Content-Type
"application/json"
... etc. Doesn't work.
I then tried using a cURL command to hit the endpoint directly with the headers set and it works without any issues.
This leads me to believe that the Cloud Console's Headers field isn't working properly.

You can try
const body = JSON.parse(req.bodyRaw)

Thanks! I'm aware of this workaround. I plan on introducing custom headers in the near future so this extends beyond just being able to define the content type.

Can you check the network logs for the request from the Console and check the payload?
What was the curl you executed?

This is odd. It seems to be working now. I ran a few with UI. I guess I'll open another issue if I see it again. But for your reference, I was using
curl -X POST <endpoint>.appwrite.global/feedback \
-H "Content-Type: application/json" \
-d '{"name": "panda", "email": "fake@placeholder.com", "message": "ur awesome", "userId": "12345"}'

Fyi, when executed via the console, the create execution API is called and it's executed asynchronously. This behaves slightly differently than calling the function domain

[SOLVED] Function Headers in Cloud Console Is Broken
Recommended threads
- custom requirements.txt file
How do I specify a custom requirements.txt file when creating a serverless function through the Appwrite console?
- Is my approach for deleting registered u...
A few weeks ago, I was advised not to use the registered users' id in my web app. Instead, I store the publicly viewable information such as username and email ...
- ❗[Help] Function stuck in "waiting" stat...
Hi Appwrite team 👋 I'm trying to contribute to Appwrite and followed the official setup instructions from the CONTRIBUTING.md guide to run the platform locall...
