I am running a function
const payload = req.body;
const userId = payload.userId;
const secretToken = payload.secretToken;
if (!userId || !secretToken) {
return res.json({
status: "failed",
message: "Invalid Parameters",
body: JSON.stringify(payload)
});
}
the key value seems to be received as a query string instead of json.
Aren't you using stringfy?
yea but it shouldn't make it a query string right with the =
nope. you see you have x-www-form-url-encoded. that's the result when you do that
what should it be then?
in Postman you have to use raw and put in the actual JSON object
Ohk Got It, That fixed it and it works fine. When i used to work with express js before i remember using the x-www-form-url-encoded to get json data in the request body.
[Solved] res.body isn't json
nope that's form data which is not json. express may have automatically been parsing the form data for you
Recommended threads
- Dart Runtime as Function is missing
Hey guys, I set the _APP_FUNCTIONS_RUNTIMES to dart-3.10 and redeployed the appwrite stack but unfortunately the dart runtime doesnt show up. I copied the val...
- Go 1.25 runtime
So I'm trying to use go 1.25 for my functions and I can only find go-1.23 as a function runtime. So I did some searching and found https://github.com/appwrite/a...
- Python TablesDB Rework
Hi, i starting to rework some older functions to TablesDB list_rows Method. I used list_documents with a resultset with worked fine. Now i tried to get all rows...