Closed androidlover5842 closed 4 years ago
Can you show me how to reproduce?
Also, are you modifying any env variables, like PATH or LD_LIBRARY_PATH?
[androidlover5842@androidlover5842-pc blank-python]$ ./2-build-layer.sh
Collecting jsonpickle==1.3
Using cached jsonpickle-1.3-py2.py3-none-any.whl (32 kB)
Collecting aws-xray-sdk==2.4.3
Using cached aws_xray_sdk-2.4.3-py2.py3-none-any.whl (87 kB)
Processing /home/androidlover5842/.cache/pip/wheels/8e/70/28/3d6ccd6e315f65f245da085482a2e1c7d14b90b30f239e2cf4/future-0.18.2-py3-none-any.whl
Processing /home/androidlover5842/.cache/pip/wheels/88/ee/ec/4fa798488a53cf7ebed7f6f47acb9accb4a687588736fda715/botocore-1.16.18-py2.py3-none-any.whl
Processing /home/androidlover5842/.cache/pip/wheels/5f/fd/9e/b6cf5890494cb8ef0b5eaff72e5d55a70fb56316007d6dfe73/wrapt-1.12.1-cp38-cp38-linux_x86_64.whl
Collecting urllib3<1.26,>=1.20
Using cached urllib3-1.25.9-py2.py3-none-any.whl (126 kB)
Collecting docutils<0.16,>=0.10
Using cached docutils-0.15.2-py3-none-any.whl (547 kB)
Collecting jmespath<1.0.0,>=0.7.1
Using cached jmespath-0.10.0-py2.py3-none-any.whl (24 kB)
Collecting python-dateutil<3.0.0,>=2.1
Using cached python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
Collecting six>=1.5
Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
ERROR: streamlink 1.3.1 requires requests<3.0,>=2.21.0, which is not installed.
ERROR: mitmproxy 5.1.1 requires flask>=1.1.1, which is not installed.
Installing collected packages: jsonpickle, future, urllib3, docutils, jmespath, six, python-dateutil, botocore, wrapt, aws-xray-sdk
Successfully installed aws-xray-sdk-2.4.3 botocore-1.16.18 docutils-0.15.2 future-0.18.2 jmespath-0.10.0 jsonpickle-1.3 python-dateutil-2.8.1 six-1.15.0 urllib3-1.25.9 wrapt-1.12.1
[androidlover5842@androidlover5842-pc blank-python]$ sam build
Building resource 'function'
Running PythonPipBuilder:ResolveDependencies
Running PythonPipBuilder:CopySource
Build Succeeded
Built Artifacts : .aws-sam/build
Built Template : .aws-sam/build/template.yaml
Commands you can use next
=========================
[*] Invoke Function: sam local invoke
[*] Deploy: sam deploy --guided
[androidlover5842@androidlover5842-pc blank-python]$ sam local invoke function
Invoking lambda_function.lambda_handler (python3.8)
libs is a local Layer in the template
Image was not found.
Building image...
Requested to skip pulling images ...
Mounting /home/androidlover5842/PycharmProjects/aws-lambda-developer-guide/sample-apps/blank-python/.aws-sam/build/function as /var/task:ro,delegated inside runtime container
/var/lang/bin/python3.8: error while loading shared libraries: libpython3.8.so.1.0: cannot open shared object file: No such file or directory
Function 'function' timed out after 10 seconds
[androidlover5842@androidlover5842-pc blank-python]$
code repo which i used for testing ->https://github.com/awsdocs/aws-lambda-developer-guide also it was working fine before 12 may
Also, are you modifying any env variables, like PATH or LD_LIBRARY_PATH?
no
It works for me
./2-build-layer.sh
Collecting jsonpickle==1.3
Using cached jsonpickle-1.3-py2.py3-none-any.whl (32 kB)
Collecting aws-xray-sdk==2.4.3
Using cached aws_xray_sdk-2.4.3-py2.py3-none-any.whl (87 kB)
Processing /Users/michael/Library/Caches/pip/wheels/56/b0/fe/4410d17b32f1f0c3cf54cdfb2bc04d7b4b8f4ae377e2229ba0/future-0.18.2-py3-none-any.whl
Collecting botocore>=1.11.3
Using cached botocore-1.16.18-py2.py3-none-any.whl (6.2 MB)
Processing /Users/michael/Library/Caches/pip/wheels/62/76/4c/aa25851149f3f6d9785f6c869387ad82b3fd37582fa8147ac6/wrapt-1.12.1-cp37-cp37m-macosx_10_15_x86_64.whl
Collecting jmespath<1.0.0,>=0.7.1
Using cached jmespath-0.10.0-py2.py3-none-any.whl (24 kB)
Collecting python-dateutil<3.0.0,>=2.1
Using cached python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
Collecting docutils<0.16,>=0.10
Using cached docutils-0.15.2-py3-none-any.whl (547 kB)
Collecting urllib3<1.26,>=1.20; python_version != "3.4"
Using cached urllib3-1.25.9-py2.py3-none-any.whl (126 kB)
Collecting six>=1.5
Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
ERROR: aws-sam-cli 0.52.0 has requirement jmespath~=0.9.5, but you'll have jmespath 0.10.0 which is incompatible.
ERROR: aws-sam-cli 0.52.0 has requirement python-dateutil<2.8.1,~=2.6, but you'll have python-dateutil 2.8.1 which is incompatible.
Installing collected packages: jsonpickle, future, jmespath, six, python-dateutil, docutils, urllib3, botocore, wrapt, aws-xray-sdk
Successfully installed aws-xray-sdk-2.4.3 botocore-1.16.18 docutils-0.15.2 future-0.18.2 jmespath-0.10.0 jsonpickle-1.3 python-dateutil-2.8.1 six-1.15.0 urllib3-1.25.9 wrapt-1.12.1
sam local invoke function
Invoking lambda_function.lambda_handler (python3.8)
libs is a local Layer in the template
Building image...
Requested to skip pulling images ...
Mounting /Users/michael/github/aws-lambda-developer-guide/sample-apps/blank-python/function as /var/task:ro,delegated inside runtime container
[INFO] 2020-05-28T13:03:05.17Z successfully patched module sqlite3
[INFO] 2020-05-28T13:03:05.23Z successfully patched module botocore
[INFO] 2020-05-28T13:03:05.35Z Found credentials in environment variables.
START RequestId: cae8b33b-f406-1b6f-7a8b-99c96e496a7a Version: $LATEST
[INFO] 2020-05-28T13:03:05.183Z cae8b33b-f406-1b6f-7a8b-99c96e496a7a ## ENVIRONMENT VARIABLES
{"AWS_DEFAULT_REGION": "us-east-1", "AWS_EXECUTION_ENV": "AWS_Lambda_python3.8", "AWS_LAMBDA_EVENT_BODY": "{}", "AWS_LAMBDA_FUNCTION_HANDLER": "lambda_function.lambda_handler", "AWS_LAMBDA_FUNCTION_MEMORY_SIZE": "128", "AWS_LAMBDA_FUNCTION_NAME": "test", "AWS_LAMBDA_FUNCTION_TIMEOUT": "10", "AWS_LAMBDA_FUNCTION_VERSION": "$LATEST", "AWS_LAMBDA_LOG_GROUP_NAME": "/aws/lambda/test", "AWS_LAMBDA_LOG_STREAM_NAME": "2020/05/28/[$LATEST]c5e4df69c53cd2ab33b545e9b84c2785", "AWS_REGION": "us-east-1", "AWS_SAM_LOCAL": "true", "AWS_XRAY_CONTEXT_MISSING": "LOG_ERROR", "AWS_XRAY_DAEMON_ADDRESS": "169.254.79.2:2000", "HOME": "/home/sbx_user1051", "HOSTNAME": "5a49b6277b17", "LAMBDA_RUNTIME_DIR": "/var/runtime", "LAMBDA_TASK_ROOT": "/var/task", "LANG": "en_US.UTF-8", "LD_LIBRARY_PATH": "/var/lang/lib:/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib:/opt/lib", "PATH": "/var/lang/bin:/usr/local/bin:/usr/bin/:/bin:/opt/bin", "PYTHONPATH": "/var/runtime", "TZ": ":UTC", "_AWS_XRAY_DAEMON_ADDRESS": "169.254.79.2", "_AWS_XRAY_DAEMON_PORT": "2000", "_HANDLER": "lambda_function.lambda_handler", "_LAMBDA_CONSOLE_SOCKET": "16", "_LAMBDA_CONTROL_SOCKET": "14", "_LAMBDA_LOG_FD": "9", "_LAMBDA_RUNTIME_LOAD_TIME": "1530232235231", "_LAMBDA_SB_ID": "7", "_LAMBDA_SHARED_MEM_FD": "11", "_X_AMZN_TRACE_ID": "Root=1-dc99d00f-c079a84d433534434534ef0d;Parent=91ed514f1e5c03b2;Sampled=1"}
[INFO] 2020-05-28T13:03:05.183Z cae8b33b-f406-1b6f-7a8b-99c96e496a7a ## EVENT
{}
[INFO] 2020-05-28T13:03:05.184Z cae8b33b-f406-1b6f-7a8b-99c96e496a7a ## CONTEXT
{"_epoch_deadline_time_in_ms": 1590670994605, "aws_request_id": "cae8b33b-f406-1b6f-7a8b-99c96e496a7a", "client_context": null, "function_name": "test", "function_version": "$LATEST", "identity": {"cognito_identity_id": null, "cognito_identity_pool_id": null, "py/object": "bootstrap.CognitoIdentity"}, "invoked_function_arn": "arn:aws:lambda:us-east-1:399994096:function:test", "log_group_name": "/aws/lambda/test", "log_stream_name": "2020/05/28/[$LATEST]c5e4df69c53cd2ab33b545e9b84c2785", "memory_limit_in_mb": "128", "py/object": "bootstrap.LambdaContext"}
END RequestId: cae8b33b-f406-1b6f-7a8b-99c96e496a7a
REPORT RequestId: cae8b33b-f406-1b6f-7a8b-99c96e496a7a Init Duration: 594.23 ms Duration: 38.67 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 42 MB
{"TotalCodeSize":7621740206,"FunctionCount":116}
Make sure you've got the latest lambci/lambda:python3.8
image:
docker pull lambci/lambda:python3.8
And if that doesn't work, then there might just be an issue with your local python setup – you might have to try building everything in a container (like lambci/lambda:build-python3.8
) and see if that works
weird i will try reinstalling everything btw image is latest version
[androidlover5842@androidlover5842-pc aws-lambda-developer-guide]$ docker pull lambci/lambda:python3.8
python3.8: Pulling from lambci/lambda
Digest: sha256:163d522c717ebcee4ee6ef615c4ad0e2eeb8e584c5fdd870b97afcb0da362a07
Status: Image is up to date for lambci/lambda:python3.8
docker.io/lambci/lambda:python3.8
[androidlover5842@androidlover5842-pc aws-lambda-developer-guide]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
samcli/lambda python3.8-739a304e183a900711f6497e6 53f86465293d 39 minutes ago 571MB
lambci/lambda python3.8 6ebd2ea3cf78 6 days ago 517MB
[androidlover5842@androidlover5842-pc aws-lambda-developer-guide]$
Error :-
version :-
SAM CLI, version 0.49.0