Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lambda error: no module found. Cryptography.hamtaz.bindings._constant_time

I created a lambda function which upload data to snowflake. I installed a all requirements in folder and zipped along with my main python file. While running in AWS it shows an error:

no module found. Cryptography.hamtaz.bindings._constant_time.

But I have this module at specified path. I don't know why it shows an error. I don't know why the error is arise.

Here is the code:

main(event, context):
  import snowflake.connector
  cnx = snowflake.connector.connect( user='xxx', password='yyyyy', account='zzzz', database="db Name", schema = "schema Name" )
  try:
    query = "SELECT * FROM Table_Name"
    cnx.cursor().execute(query)
  finally:
    cnx.close()
like image 229
Karthik Subramaniyam Avatar asked Jan 28 '23 02:01

Karthik Subramaniyam


2 Answers

I recently encountered the same issue. It turned out my Lambda function runtime was Python 3.8 but the 'cffi' library had been compiled for Python 3.6. I created a new Lambda function with the Python 3.6 runtime and uploaded my deployment package to it and it began working right away.

like image 62
jkovba Avatar answered Apr 27 '23 17:04

jkovba


I faced same issue recently and found it is a problem with windows environment, try to create linux environment, install Python, packages, zip your code with all libraries and then throw back to AWS lambda, hopefully it will work.

like image 24
ashok19r91d Avatar answered Apr 27 '23 15:04

ashok19r91d