aws / aws-lambda-nodejs-runtime-interface-client

Apache License 2.0
180 stars 56 forks source link

Update dependencies and distros #65

Closed andclt closed 1 year ago

andclt commented 1 year ago

Issue #, if available:

41 #53

Description of changes: Update dependencies and distros

Starting from npm@8.6.0, npm writes logs under the /home/.npm dir: https://github.com/npm/cli/pull/4594 This is not possible inside the Lambda execution env since the fs is read-only. In earlier versions of npm, there was a bug which caused it to silently fail when unable to write cache directory: https://github.com/npm/cli/issues/4996, hence why the runtime was just returning the 254 error code. There are some ways to prevent this:

  1. Setting the npm cache folder path to /tmp using a Docker ENV var:
    ENV NPM_CONFIG_CACHE=/tmp/.npm
  2. Use yarn instead of npm since it fallbacks to /tmp if the preferred cache folder isn't writable
  3. Setting ENV NPM_CONFIG_CACHE=/tmp/.npm inside Lambda as an env var
  4. Run aws-lambda-ric directly using node instead of using npx
make init build && make test-integ 

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.