aws-lambda-layers

AWS lambda tar file extraction doesn't seem to work

本秂侑毒 提交于 2021-01-28 11:27:38
问题 I'm trying to run serverless LibreOffice based on this tutorial. Here is the full python lambda function: import boto3 import os s3_bucket = boto3.resource("s3").Bucket("lambda-libreoffice-demo") os.system("curl https://s3.amazonaws.com/lambda-libreoffice-demo/lo.tar.gz -o /tmp/lo.tar.gz && cd /tmp && tar -xf /tmp/lo.tar.gz") convertCommand = "instdir/program/soffice --headless --invisible --nodefault --nofirststartwizard --nolockcheck --nologo --norestore --convert-to pdf --outdir /tmp" def

Added custom lambda layer caused SSL authorization error when calling AWS S3

ε祈祈猫儿з 提交于 2021-01-07 07:00:19
问题 I created a lambda layer for AWS lambda in Python 3.8, however, it is causing a SSL authorization error when calling S3 in my lambda function (even though no packages in the lambda layer are imported in the main lambda function) The following code succeeded when no lambda layer is added, but failed when added my custom lambda layer. import boto3 def lambda_handler(event, context): c1 = boto3.client("s3") lst = c1.list_buckets() print(lst) return { 'statusCode': 200, 'body': 'Hello from Lambda

How to locally debug dependencies in a lambda layer?

限于喜欢 提交于 2021-01-07 03:10:59
问题 I'm creating a lambda layer from a dockerfile that installs python packages to a directory and zips the result. FROM amazonlinux WORKDIR / RUN yum update -y # Install Python 3.7 RUN yum install python3 zip -y RUN pip3.7 install --upgrade pip # Install Python packages RUN mkdir /packages RUN echo "opencv-python" >> /packages/requirements.txt RUN mkdir -p /packages/opencv-python-3.7/python/lib/python3.7/site-packages RUN pip3.7 install -r /packages/requirements.txt -t /packages/opencv-python-3

librosa.load gives error "module 'soundfile' has no attribute 'SoundFile'

十年热恋 提交于 2020-11-29 21:09:16
问题 I have deployed librosa, matplotlib and all its required dependencies using AWS-Lambda-layers and it's working fine. When I send a .wav file from postman using the binary format the librosa.load() gives me the following error { "errorMessage": "module 'soundfile' has no attribute 'SoundFile'", "errorType": "AttributeError", "stackTrace": [ " File \"/var/task/lambda_function.py\", line 83, in lambda_handler\n clip, sample_rate = librosa.load(file_name)\n", " File \"/opt/python/librosa/core

librosa.load gives error "module 'soundfile' has no attribute 'SoundFile'

回眸只為那壹抹淺笑 提交于 2020-11-29 21:06:50
问题 I have deployed librosa, matplotlib and all its required dependencies using AWS-Lambda-layers and it's working fine. When I send a .wav file from postman using the binary format the librosa.load() gives me the following error { "errorMessage": "module 'soundfile' has no attribute 'SoundFile'", "errorType": "AttributeError", "stackTrace": [ " File \"/var/task/lambda_function.py\", line 83, in lambda_handler\n clip, sample_rate = librosa.load(file_name)\n", " File \"/opt/python/librosa/core

librosa.load gives error "module 'soundfile' has no attribute 'SoundFile'

醉酒当歌 提交于 2020-11-29 21:06:26
问题 I have deployed librosa, matplotlib and all its required dependencies using AWS-Lambda-layers and it's working fine. When I send a .wav file from postman using the binary format the librosa.load() gives me the following error { "errorMessage": "module 'soundfile' has no attribute 'SoundFile'", "errorType": "AttributeError", "stackTrace": [ " File \"/var/task/lambda_function.py\", line 83, in lambda_handler\n clip, sample_rate = librosa.load(file_name)\n", " File \"/opt/python/librosa/core

Calling a django function view from an aws lambda function

孤街醉人 提交于 2020-06-29 03:50:22
问题 I want to run my django views on AWS Lambda. For this I had created a lambda function which is calling that view function. The AWS lambda function is something like this -> import app.views as v def functionA_handler(event, context): some_value = v.functionA(event) return some_value The corresponding view in app.views file would be something like this -> from django.views.decorators.csrf import csrf_exempt from django.http import JsonResponse, HttpResponse @csrf_exempt def functionA(request):

Unable to import modules from aws lambda layer

佐手、 提交于 2020-06-17 08:08:40
问题 I have a requirements file for my pip packages. I installed it in a target folder and zipped the contents and uploaded it on AWS lambda layer. Requirements.txt asgiref==3.2.3 certifi==2019.11.28 chardet==3.0.4 cloudevents==0.2.4 decorator==4.4.1 Django==3.0 idna==2.8 jaeger-client==4.2.0 jsonpath-ng==1.4.3 pbr==5.4.4 ply==3.11 pytz==2019.3 requests==2.22.0 six==1.13.0 sqlparse==0.3.0 urllib3==1.25.7 aws-xray-sdk mysql-connector-python gunicorn I used the command pip3 install -r requirements