Asyncpg and AWS Lambda

Viewed 1165

I'm trying to use asyncpg with AWS Lambda and got next error when trying to import asyncpg

Unable to import module 'handler': No module named asyncpg.protocol.protocol'

I import python dependencies like at this answer with and without virtual environment.

upd. Found this repo with custom compiled psycopg2 what works good with AWS Lambda but for asyncpg don't found such alternative or instruction on compiling Lambda-friendly asyncpg package.

2 Answers

write your code under the def lambdahandler() and also import all libraries and function below this function.

Related