node-argon2 icon indicating copy to clipboard operation
node-argon2 copied to clipboard

No such file or directory libc.musl-x86_64.so.1 when building through github actions (ubuntu 20.04)

Open ADrejta opened this issue 4 years ago • 3 comments

I know this is probably not an issue with the package itself, but people will probably run into this and I didn't know where to start a discussion for it.

Steps to reproduce

  1. Run npm install on GitHub actions (with a ubuntu 20.04 environment)
  2. Deploy to AWS Lambda

Expected behaviour

The package should be able to run normally just like deploying from local (ubuntu 20.04) machine.

Actual behaviour

This error appears

Error: libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory

Environment

Operating system: Ubuntu 20.04 Node version: Node 14

This link provides all the preinstalled software in the ubuntu 20.04 GitHub actions VM. Is there an extra package that should be installed in the GitHub actions ubuntu 20.04 VM?

ADrejta avatar Nov 26 '21 08:11 ADrejta

Huh, your action is downloading the Alpine version instead of the Debian/glibc one. Our actions actually run on Ubuntu 20.04 so it should be more than enough. Can you provide more error logs?

ranisalt avatar Nov 26 '21 19:11 ranisalt

Here is the whole stack that gets generated in clodwatch (lambda with node):

{
    "errorType": "Error",
    "errorMessage": "libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory",
    "stack": [
        "Error: libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory",
        "    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1057:18)",
        "    at Module.load (internal/modules/cjs/loader.js:863:32)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:708:14)",
        "    at Module.require (internal/modules/cjs/loader.js:887:19)",
        "    at require (internal/modules/cjs/helpers.js:74:18)",
        "    at Object.<anonymous> (/var/task/node_modules/argon2/argon2.js:9:56)",
        "    at Module._compile (internal/modules/cjs/loader.js:999:30)",
        "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)",
        "    at Module.load (internal/modules/cjs/loader.js:863:32)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:708:14)"
    ]
}

Here is the Github actions script in case I might have missed something

jobs:
   deploy-back-end:
      name: Back-end
      runs-on: ubuntu-20.04
      steps:
         - name: Checkout
           uses: actions/checkout@v2
         - name: Run npm install
           run: npm i
         - name: Create prisma client
           run: npx prisma generate
         - name: Set debug to true for serverless
           run: export SLS_DEBUG=*
         - name: Deploy lambda functions
           uses: serverless/github-action@master
           with:
              args: deploy -v
           env:
              AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
              AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
         - name: Migrate Database
           run: npx prisma migrate deploy

ADrejta avatar Nov 28 '21 10:11 ADrejta

Hey! You might try running your actions on Alpine by adding the following:

    container:
      image: node:14-alpine

To the job. Just like we do here: https://github.com/ranisalt/node-argon2/blob/master/.github/workflows/ci.yml#L64-L65

I guess that this happens because the actions run on Ubuntu, but your Lambda functions are set to run on Alpine instead. Those are not binary compatible.

ranisalt avatar Aug 23 '22 17:08 ranisalt