Back

[SOLVED] Appwrite function not accepting res.empty() as response

  • 0
  • Functions
Aarush Acharya
3 Nov, 2023, 14:32

I have tried res.json(); as well still it could not recognize the json

TL;DR
The user was having trouble with an Appwrite function not accepting `res.empty()` as a response. The suggested solution was to add `log` to the list of arguments passed into the function and then use `log()` to show a log in the cloud function. This solution worked for the user. Another suggestion was to change the first line of the code to `module.exports = async function ({req, res})` and use `res.json()` instead of `res.empty()`. The user also mentioned trying `res.json();`, but it did not work as expected.
Aarush Acharya
3 Nov, 2023, 15:00

with res.json()

ideclon
3 Nov, 2023, 15:52

Try making the first line

TypeScript
module.exports = async function ({req, res}) {
Aarush Acharya
3 Nov, 2023, 18:29

yep that worked thanks a lot

Aarush Acharya
3 Nov, 2023, 18:30

[SOLVED] Appwrite function not accepting res.empty() as response

Aarush Acharya
3 Nov, 2023, 19:01

also @ideclon how to show a log in cloud function if I wish to

ideclon
5 Nov, 2023, 00:13

Add log to the list of arguments passed into the function, and then you can use log()

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