Skip to content
Back

Error when executing a function from postman

  • 0
  • Functions
  • Web
  • Cloud
Youssef Tarek
25 Sep, 2025, 12:57

I am trying to make a post request from postman to my function https://fra.cloud.appwrite.io/v1/functions/functionid/executions on the same body when i put from the appwrite dashboard sucess and when trying same request from postman i get

Native logs detected. Use context.log() or context.error() for better experience. Failed to parse request body as JSON: SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at Module.default (file:///usr/local/server/src/function/src/main.js:112:21) at execute (/usr/local/server/src/server.js:220:42) at action (/usr/local/server/src/server.js:237:27) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async /usr/local/server/src/server.js:26:5 This is from appwrite logs for the execution with status code 400

Cannot parse what i am doing is Const data = JSON.parse(req.body) in a try and catch block I trying changing it to req.payload but the same problem , what i am doing wrong ??

TL;DR
Developers are facing an error when executing a function from Postman due to a JSON parsing issue. The error message suggests using `context.log()` or `context.error()` for better logging. The issue is related to parsing the request body as JSON, resulting in a SyntaxError: Unexpected end of JSON input. The solution includes changing `Const data = JSON.parse(req.body)` to potentially use `req.payload` instead.
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