ming
ming3y ago

Third party packages in Convex function

Hi, Can I use npm to install and use third party libraries in convex directory? I have tried but it seems not working.
5 Replies
ballingt
ballingt3y ago
Yes, but not all libraries are compatible with queries and mutations — some must be used only in actions. @ming what are you seeing?
ming
mingOP3y ago
I see, I was trying to add axios , it shows me this
No description
sshader
sshader3y ago
Yeah it looks like axios is not compatible with queries and mutations, but should be compatible with actions. FormData specifically seems like something we should just support with queries and mutations, but other parts of axios (namely making HTTP requests) will only be compatible with actions -- Convex wants queries and mutations to be deterministic, which means they can't make external requests.
ballingt
ballingt3y ago
@ming let us know if we can help, see https://docs.convex.dev/using/actions#defining-actions for more. Something that makes HTTP requests like Axios should be used in an action.
ming
mingOP3y ago
Thanks

Did you find this page helpful?