aws-lambda

How to return from nested function in Node.js?

痴心易碎 提交于 2021-01-29 06:09:06
问题 I'm wrapping my dynamoDB function into another function and I'm having issues with returning it to the "item" const. What I'm missing here? Works: const params = { TableName: table, Key: { id: id }, }; dynamoDb.get(params, (error, result) => { if (error) { console.error(error); callback(null, { statusCode: error.statusCode || 501, body: 'Couldn\'t fetch the item.', }); return; } const item = result.Item }) Doesn't work (returns undefinied): const getFromDb = () => { const params = { TableName

Connecting Alexa skill to mysql database using node.js and aws lambda

我们两清 提交于 2021-01-29 05:55:33
问题 I am trying to connect my Alexa skill to an Amazon RDS mySQL database using node.js in AWS Lambda. I tested the connection before uploading it to lambda and it worked but when I upload it I get a 'process exited before completing request' or a 'There was a problem with the skills response' error. 'use strict'; const Alexa = require('alexa-sdk'); const APP_ID = 'amzn1.ask.skill.11069fc0-53bc-4cd0-8961-dd41e2d812f8'; var testSQL = 'SELECT weight, height from users where pin=1100'; //===========

Putting to local DynamoDB table with Python boto3 times out

元气小坏坏 提交于 2021-01-29 05:54:15
问题 I am attempting to programmatically put data into a locally running DynamoDB Container by triggering a Python lambda expression. I'm trying to follow the template provided here: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GettingStarted.Python.03.html I am using the amazon/dynamodb-local you can download here: https://hub.docker.com/r/amazon/dynamodb-local Using Ubuntu 18.04.2 LTS to run the container and lambda server AWS Sam CLI to run my Lambda api Docker Version 18.09

Create AWS Lambda function to get Users from IAM

假装没事ソ 提交于 2021-01-29 04:44:33
问题 I want to get user details from AWS IAM so I have created a lambda function but there is an error with response code 502. My code is as below. var AWS = require('aws-sdk'); var iam = new AWS.IAM(); AWS.config.loadFromPath('./config.json'); let getUsers = async (event, callback) => { var params = { UserName: "5dc6f49d50498e2907f8ee69" }; iam.getUser(params, (err, data) => { if (err) { callback(err) } else { console.log(data) callback(data) } }) }; 回答1: Since your function already is async you

I am trying to send a publish sns command via lambda however it will not send

╄→尐↘猪︶ㄣ 提交于 2021-01-29 03:52:09
问题 I have been trying for the past days to publish a sns however no matter what i code i just cant get it to send. Be aware i am not a coder, i just do this for fun. I have set up an IAM policy and rule as below and ran it with the policy simulator and it works fine. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "sns:Publish", "Resource": "arn:aws:sns:us-east-1:*******:CallBell" } ] } i have this at the beginning of my code. var AWS = require("aws-sdk"); var sns = new

Multiple response cards unable to be shown for Amazon lex chatbot

杀马特。学长 韩版系。学妹 提交于 2021-01-28 19:00:45
问题 I am currently using Amazon lex to create a chatbot and want to be able to post multiple response cards at once. The question asked by the chatbot will be "Do you have an integrated Shield Plan currently?" and followed will be multiple response cards where it will show a list of plans from different brands. But if the user does not have a plan, there will be an option called "No" on the response card. But if I publish the chatbot let's say on Slack, not even one response card is shown. How do

AVS with Alexa Skills

纵然是瞬间 提交于 2021-01-28 15:26:42
问题 Is it possible to use Alexa Skill with Alexa Voice Service (AVS)? I can't find any AVS API to link to user's Amazon account to enable certain Skills. Is it possible that to use Skill on a third party Alexa device? 回答1: I believe this is what you're looking for. https://developer.amazon.com/docs/alexa-voice-service/setup-authentication.html Alexa isn't Alexa without skills, and AVS essentially just allows Alexa to work on devices that Amazon didn't create. Once you create your third-party

How to configure my Serverless YML to use my API Gateway Authorizer?

吃可爱长大的小学妹 提交于 2021-01-28 13:09:28
问题 I'm following this tutorial to use Cognito to authorize the access to my lambda function through API Gateway. I already create my user pool with a validated user, an API Gateway authorizer and a lambda function to login and get the token ID. When I get the token ID with my lambda function and test it in AWS console, the authorizer returns 200, so I think it is working, but when I try to send the token to my lambda function it returns "401 Unauthorized" My YML configuration: teste: handler:

How to configure my Serverless YML to use my API Gateway Authorizer?

柔情痞子 提交于 2021-01-28 13:07:42
问题 I'm following this tutorial to use Cognito to authorize the access to my lambda function through API Gateway. I already create my user pool with a validated user, an API Gateway authorizer and a lambda function to login and get the token ID. When I get the token ID with my lambda function and test it in AWS console, the authorizer returns 200, so I think it is working, but when I try to send the token to my lambda function it returns "401 Unauthorized" My YML configuration: teste: handler:

Understanding AWS Lambda Limits

守給你的承諾、 提交于 2021-01-28 11:47:40
问题 I am trying to understand the "Invoke request body payload size" limit. Is this limit for response provided by the lambda function. My use case: S3 event triggers Lambda function Lambda functions consists of a call to S3 bucket to fetch fetch object. The Object (json file) is expected to be maximum 1GB. Lambda function processes data from json files and makes individual/batch calls to DynamoDB inserting necessary information derived from each json object in file. Each record DynamoDB