3

We use several namespaced private packages through NPM.

When we attempt to deploy as we always have using the EB CLI (eb deploy) everything is fine until EB attempts to run npm i. This causes the deployment to fail as EB does not have access to our NPM Organization's Packages.

I found related questions from 4+ years ago with solutions that do not seem to work.

We've resorted to the workaround of manually 'zipping' the files locally and uploading it in the GUI.

How can we allow our Elastic Beanstalk Instances to deploy with our private packages via the eb deploy command?

Matt Weber
  • 2,808
  • 2
  • 14
  • 30
  • 2
    I feel like the old answer that you linked is almost correct, but the fact that the path that is used is (`/tmp/.npmrc`) feels wrong to me. The [docs for npmrc](https://docs.npmjs.com/files/npmrc) specifies `/etc/npmrc` which may work better. It may also be worth trying to put the secret directly in the ebextension (i.e. without the `NPM_TOKEN` variable), in case the substitution doesn't work properly anymore. – stefansundin Jun 16 '20 at 17:10
  • Will give this a shot – Matt Weber Jun 17 '20 at 13:03
  • Doesnt seem to fix the issue. – Matt Weber Jun 26 '20 at 13:57
  • I wonder if this other issue is related. See these two pages: https://aws.amazon.com/premiumsupport/knowledge-center/elastic-beanstalk-eaccess-error/ and https://medium.com/quick-code/how-i-automatically-deployed-typescript-to-elastic-beanstalk-to-speed-up-server-development-22b89870e159 – stefansundin Jun 26 '20 at 18:18
  • The AWS support page linked by stefansundin mentions the following: "Create a file named .npmrc in the root directory of your application source bundle." Did you try it @MattWeber? Where did you try to put your NPM registry credentials? – Martin Löper Jun 27 '20 at 23:06

1 Answers1

0

The npm docs cover it well. The problem is, for some reason the environment variable, NPM_TOKEN isn't read and it fails. We fixed by hardcoding a read-only, IP whitelisted token into the .npmrc file.

Matt Weber
  • 2,808
  • 2
  • 14
  • 30