How do I use a module built into node?
Seems like there's an error bundling the crypto module. Any ideas on how to resolve this error?
6 Replies
Use an action https://docs.convex.dev/functions/actions and make it run in node - for convex 0.13.0 you to “use node”;. Prior to 0.13.0 you need to put it in /convex/actions folder.
Actions | Convex Developer Hub
Actions can call third party services to do things such as processing a payment
its just a helper function using the crypto module. is an action the only way?
Unfortunately, yes. We might add crypto in our js environment in the future.
I assumed actions are intended for uses that could induce side effects
Yeah, side effects is primary use case but they also as escape hatch to run in Node.js (or other permissive environments in the future)
got it thanks!