I'm working on a web app with cloud functions. I encountered an error when I used return res.send() from a function, like function trigger() {
return res.send() //when everything is done
}
But i encountered an error, i'm not able to use it from a function, but I can use it directly. Can anyone help me with this error ? I'm working with node js
Heyy 👋 Could you share more of your function? Its hard to guess from above example. Also, could you share what error exactly you are facing?
I'm facing an error which shows me to set context.res.empty() if there is an empty response.
Like I can do this
if (req.method === "POST") {
return res.send("Hey !", 200);
}
But I can't do this
` if (req.method === "POST") { function trigger() { return res.send("Hey ! Function", 200); }
trigger(); } `
Ah, I see, you will need to change trigger() to return trigger().
If you return in nested function, it doesnt automatically propagate as return of the root function.
thanks bud, if I face any issues further I will surely reach out to you !
Recommended threads
- 408 Timeout / Curl Error 7 in Executor w...
Hey everyone, I am losing my mind over a routing loop/timeout issue on a fresh self-hosted setup. I have a single Linux VPS (IP: 45.141.37.105) and one domain (...
- functions returning error 401 in local
I updated to 1.9.0, and the functions that used to work fine in 1.8.1 are now giving me a 401 error. I can't seem to find a solution. If anyone is running versi...
- Docker Compose MongoDB Setup
everythings work fine but the mongodb fails on startup everytime. log: ``` Generating random MongoDB keyfile... /bin/bash: line 9: : No such file or directory ...