aws / aws-lambda-python-runtime-interface-client

Apache License 2.0
258 stars 73 forks source link

runtime_client compiled shared library not working #97

Closed garysassano closed 1 year ago

garysassano commented 1 year ago

I clone the repo and run python setup.py bdist_wheel, then I upload the awslambdaric as a layer and try to execute it, but I get an error. I replace the runtime_client.cpython-39-x86_64-linux-gnu.so file with the original one provided by AWS and it works. I don't understand why the shared library compiled by me doesn't work.

This is the function log:

Traceback (most recent call last):
File "/opt/python/bootstrap.py", line 64, in <module>
main()
File "/opt/python/bootstrap.py", line 60, in main
awslambdaricmain.main([os.environ["LAMBDA_TASK_ROOT"], os.environ["_HANDLER"]])
File "/opt/python/awslambdaric/__main__.py", line 21, in main
bootstrap.run(app_root, handler, lambda_runtime_api_addr)
File "/opt/python/awslambdaric/bootstrap.py", line 407, in run
event_request = lambda_runtime_client.wait_next_invocation()
File "/opt/python/awslambdaric/lambda_runtime_client.py", line 68, in wait_next_invocation
response_body, headers = runtime_client.next()
AttributeError: 'NoneType' object has no attribute 'next'
Traceback (most recent call last):
File "/opt/python/bootstrap.py", line 64, in <module>
main()
File "/opt/python/bootstrap.py", line 60, in main
awslambdaricmain.main([os.environ["LAMBDA_TASK_ROOT"], os.environ["_HANDLER"]])
File "/opt/python/awslambdaric/__main__.py", line 21, in main
bootstrap.run(app_root, handler, lambda_runtime_api_addr)
File "/opt/python/awslambdaric/bootstrap.py", line 407, in run
event_request = lambda_runtime_client.wait_next_invocation()
File "/opt/python/awslambdaric/lambda_runtime_client.py", line 68, in wait_next_invocation
response_body, headers = runtime_client.next()
AttributeError: 'NoneType' object has no attribute 'next'
START RequestId: c4a31983-2db2-4f9c-82bb-1b5348a4ca8a Version: $LATEST
RequestId: c4a31983-2db2-4f9c-82bb-1b5348a4ca8a Error: Runtime exited with error: exit status 1
Runtime.ExitError
END RequestId: c4a31983-2db2-4f9c-82bb-1b5348a4ca8a
REPORT RequestId: c4a31983-2db2-4f9c-82bb-1b5348a4ca8a  Duration: 3583.98 ms    Billed Duration: 3584 ms    Memory Size: 128 MB Max Memory Used: 19 MB
garysassano commented 1 year ago

You need to build a wheel using manylinux2014 Docker image in order to make the package work on most Linux distros, and that's actually what's being distributed on PyPI.