Issue using externalPackages Not Excluding Dependencies
I am trying to use fabric
fabric/node in a convex node action and it seems it's dependency canvas cannot be bundled and will produce this issue when deploying convex functions
It seems to me that the solution should be to add this to convex.json as shown here https://docs.convex.dev/functions/bundling#external-packages
However this does not solve the issue
Also I think that adding node.externalPackages does nothing as I did an experiment
But when I npx convex dev --once --debug-bundle-path /tmp/myBundle I still see lodash being bundled. I would have expected myBundle to contain a node_modules folder with lodash there separately (if I have understood this correctly).
Sample Code
I created a minimal reconstruction branched from one of the convex-samples, and put my node action in convex/issue.ts
Steps to reproduce
You can see my failed debugging attempt to externalize lodash here https://github.com/ziggy6792/convex-issue/tree/debug/bundle-lodash
And my failed attempt to externalize canvas here https://github.com/ziggy6792/convex-issue.git
Any help would be greatly appreciated or if someone has a sample repo where node.externalPackages is demonstrated that would be great (maybe I do not understand how it should work)
Thanks!GitHub
GitHub - ziggy6792/convex-issue at debug/bundle-lodash
Contribute to ziggy6792/convex-issue development by creating an account on GitHub.
GitHub
GitHub - ziggy6792/convex-issue
Contribute to ziggy6792/convex-issue development by creating an account on GitHub.
Bundling | Convex Developer Hub
Bundling is the process of gathering, optimizing and transpiling the JS/TS
3 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
Your file is called
conxex.json instead of convex.json (the 4th character is x instead of v).
We should... probably print some better debugging info here because it took me a while to spot it 😅
But your understanding of how externalPackages is supposed to work is correct -- I think we were just defaulting to having no externalPackages since the config was in the misnamed file@sshader wow thanks so much! You are correct (and I am an idiot 🤣).
Everything works fine now