aws-lambda

Facing issue: scan dynamo DB

故事扮演 提交于 2019-12-24 11:28:55
问题 I've created apis in nodejs to scan and query dynamoDB table(contains 70K records). I'm stuck with scan api. I've two APIs for scan - 1. Scanning table with limit of 500 - getting proper response 2. Scanning table without any limit - response code 403 And if I'm calling the same query without any limit through cli, getting full response. Not getting what's the problem. api.get('/deviceData', function (request) { // GET all users return dynamoDb.scan({ TableName: 'student', Limit: 500 })

JS - use files meant for <script> in Node

≯℡__Kan透↙ 提交于 2019-12-24 10:51:55
问题 I have used AWS's JS Builder (https://sdk.amazonaws.com/builder/js/) to generate a minified build of only their Lambda SDK. Now I want o use that in a NodeJS-like (specifically ReactJS) environment. Currently, I am doing so (after referring https://stackoverflow.com/a/49218103/1847976) by adding the said script in the /public/index.html and then accessing the main export (here: AWS ) via the window object (as in here window.AWS ). However, are there any issues (specifically compatibility

How to choose Elastic IP when my aws lambda function execute

拈花ヽ惹草 提交于 2019-12-24 10:46:26
问题 I want to select specific Elastic IP my own when my lambda function executed. my service has to respond to several situations, and by user's attributes. Could I write code in a lambda function, that can choose specific my own elastic IP? I had searched for this. but old information says it cannot do. but recently I heard about it is possible by using Network Load Balancer or Application Load Balancer. But I don't know how to use this for the problem. 回答1: No. You cannot associate an Elastic

Update amazon s3 object meta data with lambda without performing a object copy?

 ̄綄美尐妖づ 提交于 2019-12-24 10:45:27
问题 Is it possible to add or update an s3 objects metadata with a lambda function without making a copy of the object? This 2 year old post says that we do need to make a copy, but its 2 years old, so maybe things have changed? 回答1: In one sense, nothing has changed, fundamentally, because objects are immutable, and metadata is part of the object. To "change" an immutable object requires a copy and replace. However , S3 objects now support tagging, which is a different class of "metadata,"

AWS Cognito Pre authentication/Define Auth Challenge lambda hooks are not invoked if user doesn't exist

天大地大妈咪最大 提交于 2019-12-24 10:36:40
问题 I'm essentially trying to create a middleware that will do some work before logging a user in. However, none of the lambda hooks run when I try to log in with a user that doesn't exist in aws cognito. 回答1: This is expected. Before calling the pre-authentication trigger, Cognito checks to see if the user exists. This is so that it can pass required information like 'sub', 'email', 'phone' etc. to the triggers. Now, when you put the wrong user in the UI, the Cognito check results in a 'User

keyInvalid Error when calling Google Calendar API

倾然丶 夕夏残阳落幕 提交于 2019-12-24 09:59:54
问题 I'm writing a Lambda function that queries Google Calendar events. Although I successfully created a credential (client ID, and client secret) on Google Developers Console, I cannot access the events. Error: { "error": { "errors": [{ "domain": "usageLimits", "reason": "keyInvalid", "message": "Bad Request" } ], "code": 400, "message": "Bad Request" } } My http request looks like this: https://www.googleapis.com/calendar/v3/calendars/MY_CLIENT_ID/events?key=MY_CLIENT_SECRET What went wrong?

aws lambda call not populating body on POST

北慕城南 提交于 2019-12-24 09:55:42
问题 Thanks to help from EVK on my previous Q (can use API GET but not API POST) I was able to resolve the problem of not being able to make an API POST request from an aws lambda in node, when I could hit the GET. The problem was not populating post_options. Anyway, now I am able to successfully call the post but I cant get the body populated. related documentation https://nodejs.org/api/http.html#http_http_request_options_callback If you see my API POST call below. //// POST api/<controller>

terraform does not detect changes to lambda source files

南楼画角 提交于 2019-12-24 09:23:50
问题 In my main.tf I have the following: data "template_file" "lambda_script_temp_file" { template = "${file("../../../fn/lambda_script.py")}" } data "template_file" "library_temp_file" { template = "${file("../../../library.py")}" } data "template_file" "init_temp_file" { template = "${file("../../../__init__.py")}" } data "archive_file" "lambda_resources_zip" { type = "zip" output_path = "${path.module}/lambda_resources.zip" source { content = "${data.template_file.lambda_script_temp_file

Cannot find MySQL in NodeJS using AWS Lambda

最后都变了- 提交于 2019-12-24 09:03:07
问题 I have the following code that I would like to execute. I have tried requiring mysql and node-mysql and they both give me the same error: Code: var AWS = require("aws-sdk"); var mysql = require("mysql"); exports.handler = (event, context, callback) => { try { console.log("GOOD"); } catch (error) { context.fail(`Exception: ${error}`) } }; Error: { "errorMessage": "Cannot find module 'mysql'", "errorType": "Error", "stackTrace": [ "Function.Module._load (module.js:417:25)", "Module.require

Is it possible to invoke a Lambda function with a cognito userpool identity?

佐手、 提交于 2019-12-24 08:50:05
问题 I want to invoke a Lambda function using the Javascript API. I want it to be invoked with the cognito userpool credentials of the user who is authenticated on the browser. The objective is that the Lambda function will have the same level of access to S3 as the user from the cognito userpool. How can I do this? thanks 回答1: You can do that by federating user pool token with Cognito federated identity, this will give you temporary AWS credentials to call AWS Lambda function. You will need to