aws-lambda

How to increase the maximum size of the AWS lambda deployment package (RequestEntityTooLargeException)?

不打扰是莪最后的温柔 提交于 2021-02-04 05:18:47
问题 I upload my lambda function sources from AWS codebuild. My Python script uses NLTK so it needs a lot of data. My .zip package is too big and an RequestEntityTooLargeException occurs. I want to know how to increase the size of the deployment package sent via the UpdateFunctionCode command. I use AWS CodeBuild to transform the source from a GitHub repository to AWS Lambda . Here is the associated buildspec file: version: 0.2 phases: install: commands: - echo "install step" - apt-get update -

Using SAM file to remove default “Stages” in AWS ApiGateway?

ⅰ亾dé卋堺 提交于 2021-01-29 21:40:42
问题 I'm deploying a serverless application via Visual Studio using SAM file. At the end of the SAM file I've created a section of : "Type": "AWS::ApiGateway::Deployment" Which controls the deployment process : ,"APIGatewayDeploymenta727bb8729": { "Type": "AWS::ApiGateway::Deployment", "Properties": { "RestApiId": "3pb9y46oll", "Description": "....", "StageName": "Royi" <-----Notice here } } },... And Indeed , it creates a stage name : "Royi": But it also create two default stages named : "Prod &

How to access AWS CodeBuild reports in a Lambda?

我是研究僧i 提交于 2021-01-29 20:08:49
问题 At the moment I have an EventBridge sending CodeBuild build phase updates that have status "FAILED" to a Lambda. Specifically - unit tests are run and then a report is created that contains information about all the tests that were run. The event that is received by my Lambda from CodeBuild contains ARN for the reports and I would like the Lambda to read that ARN, access the report and output what's gone wrong. I can't seem to find a way to access the CodeBuild report within a Lambda - AWS

Unable to create AWS Lambda Deployment Package for ipopt, pyomo, cython

安稳与你 提交于 2021-01-29 18:27:14
问题 I'm trying to create an AWS Lambda Deployment Package, so I can use it as an AWS Lambda Layer. Specifically, I'm trying to use the ipopt sovler, in conjuction with the pyomo and cython. I can get the pyomo packaged without issue, but when I try to pip install ipopt for the package I get an error: ERROR: Command errored out with exit status 1: command: 'c:\python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\username\\AppData\\Local\\Temp\\pip-install-rir

How can I use async lambdas without a try/catch block and still have custom error messages?

前提是你 提交于 2021-01-29 15:21:02
问题 I'm trying to avoid wrapping all my awaited calls in an async lambda with a try catch. I want to catch and send custom error responses, but wrapping each awaited call in a try/catch is syntactically ugly compared to .catch() . Is there a way to do something like this: exports.hanlder = async (event, context, callback) => { const foo = await bar(baz).catch((error) => { eventResponse.statusCode = 503; eventResponse.body = JSON.stringify({ message: 'unable to bar' , error}); // normally we'd

How to access Cognito Userpool from inside a lambda function?

别等时光非礼了梦想. 提交于 2021-01-29 13:47:56
问题 I'm using AWS Amplify for authentication in my app. I'm using email address as username and phone number for MFA. But, I also need the phone numbers to be unique, so I created this pre-signup lambda trigger: const aws = require('aws-sdk'); exports.handler = async (event, context, callback) => { const cognito = new aws.CognitoIdentityServiceProvider(); const params = { AttributesToGet: [], Filter: `phone_number = "${event.request.userAttributes.phone_number}"`, Limit: 1, UserPoolId: event

Lambda Function to write to csv and upload to S3

こ雲淡風輕ζ 提交于 2021-01-29 13:44:08
问题 I have a Python Script that gets the details of the unused security groups. I want that to write into a CSV file and upload to S3 Bucket. When I test it in local machine it writes to CSV in the local machine. But when I execute that as a lambda function, it needs a place to save the CSV. So I am using s3. import boto3 import csv ses = boto3.client('ses') def lambda_handler(event, context): with open('https://unused******- 1.amazonaws.com/Unused.csv', 'w') as csvfile: writer = csv.writer

How to extract body and file name from mulitpart file?

假如想象 提交于 2021-01-29 10:09:32
问题 I am writing an AWS lambada in Java. This lambda acts as a handler for APIGatewayProxyRequestEvent. API gateway endpoint is sending a file as a multipart/form-data in the body. public class LambdaHandler extends SpringBootRequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> { --- } while trying to implement the business logic, I am first extracting the body into an array of bytes byte[] file = Base64.decodeBase64(event.getBody().getBytes()); But when I write these bytes

Failed to decode downloaded font on lambda production app

六眼飞鱼酱① 提交于 2021-01-29 09:59:11
问题 I am trying to deploy an angular web app to amazon lambda with the serverless module. When I run the app in local everything works fine. The problem comes up when I deploy the app to AWS. Once the app is deployed, the app is working fine but some fonts appear to be missing and do not display correctly. This are the warnings that come up in the Chrome developer console: Failed to decode downloaded font: <URL> OTS parsing error: Size of decompressed WOFF 2.0 is less than compressed size OTS

How to use AWS lambda to convert pdf files to .txt with python

只愿长相守 提交于 2021-01-29 09:57:46
问题 I need to automate the conversion of many pdf to text files using AWS lambda in python 3.7 I've successfully converted pdf files using poppler/pdftotext, tika, and PyPDF2 on my own machine. However tika times out or needs to run a java instance on a host machine which I'm not sure how to set up. pdftotext needs poppler and all the solutions for running that on lambda seems to be outdated or I'm just not familiar enough with binarys to make sense of that solution. PyPDF2 seems the most