arc.codes icon indicating copy to clipboard operation
arc.codes copied to clipboard

Add missing steps for installing Node.js runtime helpers

Open jcohenho opened this issue 2 years ago • 4 comments

Thank you for helping out! ✨

We really appreciate your commitment to improving Architect

To maintain a high standard of quality in our releases, before merging every pull request we ask that you've completed the following:

  • [X] Forked the repo and created your branch from main
  • [X] Made sure tests pass (run npm it from the repo root)
  • [X] Updated relevant documentation internal to this repo (e.g. readme.md, help docs, inline docs & comments, etc.)
  • [X] Linked to any related issues, PRs, etc. below that may relate to, consume, or necessitate these changes

Please also be sure to completed the CLA as it's required for your PR to be merged. A github comment will prompt you if you haven't already.

Learn more about contributing to Architect here.

Thanks again!

jcohenho avatar Mar 16 '22 22:03 jcohenho

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Mar 16 '22 22:03 CLAassistant

@architect/functions (or any Node package) can be installed at the root of an Arc project and then required in any function. This works in Sandbox since the entire project is run in a single service from the root. Upon deployment, Arc will look at each function's syntax tree and decide what needs to be present in each deployed Lambda.

It is possible to use a package.json in individual functions but is not necessary for most use cases and is a bit more arduous/error prone.

tbeseda avatar Mar 16 '22 22:03 tbeseda

@jcohenho as @tbeseda pointed out in his last comment it's not necessary to cd into the lambda to install dependencies. You can do it if you want to manually manage the deps. My follow up question is did you run into a problem where it was necessary to install the deps in each lambda?

macdonst avatar Apr 01 '22 15:04 macdonst

@macdonst you can follow all of the discussions related to this here, there are several differences in opinions and strategies it seems: https://discord.com/channels/880272256100601927/884128364531699754/953787371101487144

Personally, I was confused about needing to install dependencies per package for different runtimes but for node you can use the project-level package.json, and choose later if you want to use a package.json per lambda.

jcohenho avatar Apr 05 '22 21:04 jcohenho