ranisalt / node-argon2

Node.js bindings for Argon2 hashing algorithm
https://www.npmjs.com/package/argon2
MIT License
1.84k stars 92 forks source link

Error deploying to AWS Elastic Beanstalk #349

Open husseinamar opened 2 years ago

husseinamar commented 2 years ago

Welcome to the issues section if it's your first time!

Before creating an issue, please be sure to:

Steps to reproduce

  1. Create project
  2. Deploy to Elastic Beanstalk through Pipeline from Github Repo
  3. Wait for build to finish and be deployed, when it starts to run this happens

Expected behaviour

Run normally. I am developing on an M1 Macbook Air, everything works perfectly well with the prebuilt binaries, when I push the changes, the Pipeline shows that all packages were installed and finished building, but deploying to the instance fails because it can't start due to the below error. I tried rebuilding the binaries myself in the buildspec.yml file by moving argon2 to being a devDependancy on my local machine and then installing it for production using the buildspec.yml and and rebuilding afterwards, also didn't work.

Actual behaviour

Jul 12 08:42:40 ip-172-31-29-47 web: node:internal/modules/cjs/loader:1189 Jul 12 08:42:40 ip-172-31-29-47 web: return process.dlopen(module, path.toNamespacedPath(filename)); Jul 12 08:42:40 ip-172-31-29-47 web: ^ Jul 12 08:42:40 ip-172-31-29-47 web: Error: /var/app/current/node_modules/argon2/lib/binding/napi-v3/argon2.node: cannot open shared object file: No such file or directory Jul 12 08:42:40 ip-172-31-29-47 web: at Object.Module._extensions..node (node:internal/modules/cjs/loader:1189:18) Jul 12 08:42:40 ip-172-31-29-47 web: at Module.load (node:internal/modules/cjs/loader:981:32) Jul 12 08:42:40 ip-172-31-29-47 web: at Function.Module._load (node:internal/modules/cjs/loader:822:12) Jul 12 08:42:40 ip-172-31-29-47 web: at Module.require (node:internal/modules/cjs/loader:1005:19) Jul 12 08:42:40 ip-172-31-29-47 web: at require (node:internal/modules/cjs/helpers:102:18) Jul 12 08:42:40 ip-172-31-29-47 web: at Object. (/var/app/current/node_modules/argon2/argon2.js:6:25) Jul 12 08:42:40 ip-172-31-29-47 web: at Module._compile (node:internal/modules/cjs/loader:1105:14) Jul 12 08:42:40 ip-172-31-29-47 web: at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) Jul 12 08:42:40 ip-172-31-29-47 web: at Module.load (node:internal/modules/cjs/loader:981:32) Jul 12 08:42:40 ip-172-31-29-47 web: at Function.Module._load (node:internal/modules/cjs/loader:822:12) { Jul 12 08:42:40 ip-172-31-29-47 web: code: 'ERR_DLOPEN_FAILED' Jul 12 08:42:40 ip-172-31-29-47 web: } Jul 12 08:42:41 ip-172-31-29-47 web: node:internal/modules/cjs/loader:1189 Jul 12 08:42:41 ip-172-31-29-47 web: return process.dlopen(module, path.toNamespacedPath(filename)); Jul 12 08:42:41 ip-172-31-29-47 web: ^ Jul 12 08:42:41 ip-172-31-29-47 web: Error: /var/app/current/node_modules/argon2/lib/binding/napi-v3/argon2.node: cannot open shared object file: No such file or directory Jul 12 08:42:41 ip-172-31-29-47 web: at Object.Module._extensions..node (node:internal/modules/cjs/loader:1189:18) Jul 12 08:42:41 ip-172-31-29-47 web: at Module.load (node:internal/modules/cjs/loader:981:32) Jul 12 08:42:41 ip-172-31-29-47 web: at Function.Module._load (node:internal/modules/cjs/loader:822:12) Jul 12 08:42:41 ip-172-31-29-47 web: at Module.require (node:internal/modules/cjs/loader:1005:19) Jul 12 08:42:41 ip-172-31-29-47 web: at require (node:internal/modules/cjs/helpers:102:18) Jul 12 08:42:41 ip-172-31-29-47 web: at Object. (/var/app/current/node_modules/argon2/argon2.js:6:25) Jul 12 08:42:41 ip-172-31-29-47 web: at Module._compile (node:internal/modules/cjs/loader:1105:14) Jul 12 08:42:41 ip-172-31-29-47 web: at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) Jul 12 08:42:41 ip-172-31-29-47 web: at Module.load (node:internal/modules/cjs/loader:981:32) Jul 12 08:42:41 ip-172-31-29-47 web: at Function.Module._load (node:internal/modules/cjs/loader:822:12) { Jul 12 08:42:41 ip-172-31-29-47 web: code: 'ERR_DLOPEN_FAILED' Jul 12 08:42:41 ip-172-31-29-47 web: }

Environment

Operating system: 64bit Amazon Linux 2, t4g.medium instance

Node version: 16.15.0 / 8.5.5

Compiler version: gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-15)

MatLeid commented 1 year ago

Hello, we ran into the same issue with AWS and Beanstalk (AWS Graviton instance type). Using argo version 0.30.3 and got the same error message.

Environment

Operation System: t4g.small

Node version: 14.20.1

Any help would be appreciated.

faithfulojebiyi commented 1 year ago

create a .npmrc file and add the following code unsafe-perm=true

husseinamar commented 9 months ago

create a .npmrc file and add the following code unsafe-perm=true

already have this in the root folder

ranisalt commented 3 months ago

This may have been caused by the way prebuilt binaries were download. It has been changed with 0.40.x and I hope it fixes your issue