Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(debug): Add NODE_PATH env var when debugging Node10/12 (aws#1646)
To support debugging for Nodejs10.x and Nodejs12.x, SAM CLI overrides the entrypoint to the container. In newer runtimes (that are based on the provided runtime), we overrided the bootstrap file which can have side-effects. In the case of Nodejs, the bootstrap file adds the NODE_PATH env var. Since we override this, NODE_PATH does not get setup on the system and causes modules to not load (in some cases, aws#1246). With aws#1634 (Java11 Debug support), we added a capability to attach Env Vars into the container for debug mode invokes. We will use this to apply the NODE_PATH onto the container for debug. I attempted to move all the args we pass into NODE_OPTIONS, which would make Nodejs work like Java11 for debug. That is, allow us not to override the entrypoint and still be able to apply the needed flags to the interpreted. Unfortunately, NODE_OPTIONS restricts values that can be passed in, which includes `--nolazy`. This flag is used to tell Nodejs to parse all JavaScript files first instead of on first access. This ensures that breakpoints to not "jump" to a different location in the file. It could be worth exploring whether `--nolazy` is strictly required but for now leaving as is.
- Loading branch information