aws-lambda

Is there any way to catch AWS lambda timed out error in code level?

有些话、适合烂在心里 提交于 2019-12-23 15:21:07
问题 Is there any way to catch AWS lambda timed out error in code-level so that I can have a chance to handle for the error before exiting the lambda function? 回答1: While the lambda environment doesn't fire a "timing out" event, you can do this yourself fairly trivially. Each language has a function exposed by the context object to get the remaining time in milliseconds. You can use that, in tandem with the timer functionality of whatever language you're using to ensure you get notified before

Lambda error: no module found. Cryptography.hamtaz.bindings._constant_time

旧巷老猫 提交于 2019-12-23 13:16:20
问题 I created a lambda function which upload data to snowflake. I installed a all requirements in folder and zipped along with my main python file. While running in AWS it shows an error: no module found. Cryptography.hamtaz.bindings._constant_time. But I have this module at specified path. I don't know why it shows an error. I don't know why the error is arise. Here is the code: main(event, context): import snowflake.connector cnx = snowflake.connector.connect( user='xxx', password='yyyyy',

AWS Lambda function not saving on VPC selection

▼魔方 西西 提交于 2019-12-23 13:13:16
问题 I cant save my Lambda (Node.js)function on AWS with VPC selection, its not saving at all and did not get any message from AWS. When I try to save without VPC selection its working but then I select VPC its not saving at all. Its always showing same status save. When I click on this, its not saving after refresh its again back to the previous form. 回答1: This happens most of the time when the role you have configured for lambda does not have access to the VPC. There is an error appearing at the

Using API Gateway to publish SNS topics / multiple lambda function with API Gateway

强颜欢笑 提交于 2019-12-23 13:09:04
问题 Right now my requirement is, whenever I get data through API, I have to save it into 2-3 different places (for example, into my own DB, into some BI service and also sometimes into a logging DB). I don't know if it's possible to bind a single resource and single method into multiple lambda functions or so. So, my alternate approach was, as I already know how to trigger multiple lambda functions by subscribing to SNS topic, I thought maybe if I can somehow publish to SNS topic from the API

DynamoDB Streams with Lambda, how to process the records in order (by logical groups)?

血红的双手。 提交于 2019-12-23 12:23:09
问题 I want to use DynamoDB Streams + AWS Lambda to process chat messages. Messages regarding the same conversation user_idX:user_idY (a room) must be processed in order. Global ordering is not important. Assuming that I feed DynamoDB in the correct order (room:msg1, room:msg2, etc), how to guarantee that the Stream will feed AWS Lambda sequentially, with guaranteed ordering of the processing of related messages (room) across a single stream ? Example, considering I have 2 shards, how to make sure

NodeJS stream out of AWS Lambda function

隐身守侯 提交于 2019-12-23 12:16:39
问题 We are trying to migrate our zip microservice from regular application in nodejs Express to AWS API Gateway integrated with AWS Lambda. Our current application sends request to our API, gets list of attachments and then visits those attachments and pipes their content back to user in form of zip archive. It looks something like this: module.exports = function requestHandler(req, res) { //... //irrelevant code //... return getFileList(params, token).then(function(fileList) { const filename =

AWS node.js lambda request dynamodb but no response (no err, no return data)

☆樱花仙子☆ 提交于 2019-12-23 10:27:04
问题 I am playing the aws mobilehub with react-native and I was hoping that it can speed up the backend hosting for me. However, I cannot get its backend API working. After a long run with their docs, I pin down the problem between its lambda function and dynamodb service. Any thoughts are greatly appreciated! Problem#1 As the titled says: my aws lambda functions can request its dynamodb but has no response. What went wrong here? Or how can I get debug info from AWS dynamodb? (I gg and enabled

AWS lambda add PATH variable?

假如想象 提交于 2019-12-23 10:08:00
问题 I need to append the root path of the ZIP file for Amazon Lambda function because I have placed an executable file there. I have tried: PATH = "$PATH:$LAMBDA_TASK_ROOT:/" It did not work. 回答1: You can set it in the lambda console itself by modifying the environment variables. 来源: https://stackoverflow.com/questions/47136472/aws-lambda-add-path-variable

AWS API Gateway Custom Authorizer not running

大城市里の小女人 提交于 2019-12-23 10:00:58
问题 I have created a Lambda function which I've configured as the 'custom auth' on the method request of one of my API endpoints. When I use the 'test' function of the AWS API Gateway I don't see any output from my Lambda function in the log output. I have 'deployed' the API. However something is happening because when I hit the api endpoint using the configured custom domain name I get {"message":"Unauthorized"} However if I remove the 'custom auth' from this endpoint and hit the same endpoint,

Paginating a DynamoDB query in boto3

ⅰ亾dé卋堺 提交于 2019-12-23 09:42:34
问题 How can I loop through all results in a DynamoDB query, if they span more than one page? This answer implies that pagination is built into the query function (at least in v2), but when I try this in v3, my items seem limited: import boto3 from boto3.dynamodb.conditions import Key, Attr dynamodb = boto3.resource('dynamodb') fooTable = dynamodb.Table('Foo') response = fooTable.query( KeyConditionExpression=Key('list_id').eq('123') ) count = 0 for i in response['Items']: count += 1 print count #