How to pass the http request object as an argument
I have to use node libraries when performing operations within my http action, so for this reason I've pulled out the code that will run in the node runtime into an action that live in file with the
use node
directive. I call the node action from within the http action, but need to pass the request object to the node action.
In my node action I accept the args as follows:
When I do that however I get a type error. It looks like Convex can not serialize the request object and pass it as a method param. Is there a best practice here?
2 Replies
Convex function arguments and return values must be serializable, so you can’t pass in a request object. What I’ve done in these scenarios is pass the parts I need that are serializable, like headers, and create a new request in the function with that data.
I see. Thank you