3

I'm trying to add the python zip files to was lambda which contains psycopg2 files in it.I'm getting an error. please try to help

  "errorMessage": "Unable to import module 'handler': libpq.so.5: cannot open shared object file: No such file or directory",
  "errorType": "Runtime.ImportModuleError"
1

2 Answers 2

9

The point is psycopg2 depends on native code (libpq.so) and your zip file does not contain this dependency.

See here for a solution

Another option is pip install psycopg2-binary. See here for details.

Sign up to request clarification or add additional context in comments.

Comments

0

Resolved this error on GitHub Actions with following code:

- name: Package Lambda function
  run: |
    mkdir package
    cp main.py package/
    pip install psycopg2-binary -t package/
    pip install -r requirements.txt -t package/
    cd package
    zip -r ../function.zip .
    cd ..

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.