jkehler / awslambda-psycopg2

1.12k stars 363 forks source link

ELF file's phentsize not the expected size #48

Closed marcusway closed 4 years ago

marcusway commented 5 years ago

No matter which runtime (Python 2.7, 3.6, or 3.7, with or without ssl) I use, I keep getting the following error.

 "errorMessage": "Unable to import module 'lambda_function': /var/task/psycopg2/_psycopg.cpython-37m-x86_64-linux-gnu.so: ELF file's phentsize not the expected size",

I see someone ran into the same message in Issue 36 and was able to fix after this response:

Sounds like you were using a custom compiled library that was compiled on a different platform and imported into lambda

I'm not sure I understand, though. I thought that the intention was that these binaries were precompiled specifically to run in lambda?

thisboyiscrazy commented 4 years ago

I am having the same problem, I also tried compiling it on Amzon Linux 2018.03 with python 3.6 and I am getting the same error.

thisboyiscrazy commented 4 years ago

I font the problem I was having.

I have a folder lambda_func with main.py and the psycopg2 folder in it.

I was zipping up the lambda_func folder from one level up. So the zip file had a directory lambda_func.

Then I was moving main.py and psycopg2 up a level after uploading them. and deleting the lambda_func directory. This was causing the problem.

I zipped up the files from inside the directory so I did not have to move them and everything worked.

p2327 commented 4 years ago

I still have this problem and dont understand how you fixed it can you explain better? @thisboyiscrazy