lambci / git-lambda-layer

A layer for AWS Lambda that allows your functions to use `git` and `ssh` binaries
MIT License
344 stars 40 forks source link

Cannot load PCRE #23

Closed wookieb closed 4 years ago

wookieb commented 4 years ago

Unfortunatelly I got this error when trying to use git in real AWS Lambda /opt/bin/git: error while loading shared libraries: libpcre2-8.so.0: cannot open shared object file: No such file or directory

Runtime: nodejs12.x

Used layer: arn:aws:lambda:eu-central-1:553035198032:layer:git-lambda2:6

mhart commented 4 years ago

Are you using any other layers or modifying any environment variables?

wookieb commented 4 years ago

No sir :)

git-lambda2 is the only layer used

The only ENV variable I do set is "AWS_NODEJS_CONNECTION_REUSE_ENABLED=1"

mhart commented 4 years ago

How are you executing git? Is it just like in the README, or are you perhaps not inheriting env variables?

Can you add this to your lambda somewhere?

const { execSync } = require('child_process')
console.log(execSync('ls -l /opt/lib/libpcre2*', {encoding: 'utf8'}))
console.log(process.env.LD_LIBRARY_PATH)
wookieb commented 4 years ago

My friend. This is it! I was using simple-git and it didn't inherit env from process. Adding git().env(process.env) helped!

Thank You so much! :)

mhart commented 4 years ago

Ah, you should've said! Ok, glad you solved the issue

wookieb commented 4 years ago

TBH I didn't even though that simple-git would omit ENV variables. For me it was obvious :/. Thank You for your quick help again!