yarrichar
yarrichar2y ago

Add function dependencies

I'm wanting to make use of a 3rd part library in an internalAction - is this possible, and if so where do I specify it? I assume not in the root level package.json for my project since that has all my web app dependencies. My project setup is very simple atm - I've basically followed the nextjs (pages dir) quickstart guide.
4 Replies
ballingt
ballingt2y ago
Root level package.json is right to get it installed, the bundler will then follow the imports and everything should just work @yarrichar what library is it if you don't mind sharing? Most work, but some don't — if it uses Node.js-specific APIs, you'll need to use a node action instead of a mutation
yarrichar
yarricharOP2y ago
aws sdk I guess I should just give it a go and see what happens 🙂
Michal Srb
Michal Srb2y ago
Worth mentioning that a decent frontend bundler will not bundle dependencies which you don’t actual import in your frontend code.
yarrichar
yarricharOP2y ago
Yup, understood. I just wasn't sure that the build process for the functions would look at those dependencies. For what it's worth - it seems to be working. The only real trick was that I had to use the node runtime. Thanks for your help!

Did you find this page helpful?