Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

539
Visualizações
psycopg2 does not work with Serverless framework deployment on AWS Lambda

I am trying to make a lambda function connect to Redshift, and deploy the same via The Serverless Framework.

serverless.yml config:

pythonRequirements:
    dockerizePip: non-linux
    dockerFile: ./Dockerfile

Dockerfile:

FROM lambci/lambda:build-python3.6
RUN yum install -y postgresql-devel postgresql-libs

requirements.txt

psycopg2==2.8.5
requests==2.22.0
boto3==1.9.234

Deployment is done via:

sls deploy --function fn_name --force

AWS Lambda gives an error:

libpq.so.5: cannot open shared object file: No such file or directory

And I can confirm that it is missing, but when I test the same with local docker image, the file is present. I'm still unsure on how serverless actually deploys the package

I do not want to use psycopg2-binary and I'm still unsure about aws-psycopg2, any suggestions on how to get the code to run?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You can try using this module instead of default one (Supports only Python3.x)

https://pypi.org/project/aws-psycopg2/

While the above is not actively maintained, and has the max version as psycopg2==2.8.4, it could serve the use-case you might have.

You can also try zipping and uploading the package from here https://github.com/jkehler/awslambda-psycopg2 if you need support for older python versions.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda