How to resolve "use platform: node" error when compiling a node package?
The exact error is:
The package "https" wasn't found on the file system but is built into node. Are you trying to
bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
Bit new to node, so not sure where exactly to include this setting. Any help would be greatly appreciated !
2 Replies
It sounds like you're using an nom package that uses a Node.js library in the Convex runtime. You can't do this in a Convex mutation or query. You can do this in some actions, see https://docs.convex.dev/functions/actions#calling-third-party-apis-and-using-npm-packages
Actions | Convex Developer Hub
Actions can call third party services to do things such as processing a payment
Thanks Tom, much appreciated !