aws-lambda

AWS Lambda and IAM error on deploy: The role defined for the function cannot be assumed by Lambda

青春壹個敷衍的年華 提交于 2020-01-23 13:23:45
问题 In my AWS project, I use the serverless framework to deploy lambda function and IAM roles. So I created 6 lambda functions, all using the same IAM Role below: functions: auto-delete-identity: handler: src/auto-delete-identity.handler role: arn:aws:iam::123456789012:role/lambdaIAMRole name: auto-delete-identity auto-move-to-user-group: handler: src/auto-move-to-user-group.handler role: arn:aws:iam::123456789012:role/lambdaIAMRole name: auto-move-to-user-group auto-validate-user-creation:

Nodejs API call returning undefined to lambda function

做~自己de王妃 提交于 2020-01-23 08:36:44
问题 This is the aws lambda function which will invoke an api: 'use strict'; var request = require("request") exports.handler = function (event, context,callback) { let url = "https://3sawt0jvzf.execute-api.us-east-1.amazonaws.com/prod/test" request({ url: url, method: "POST", json: event, }, function (error, response, body) { if (!error && response.statusCode === 200) { callback(null, { "isBase64Encoded": true|false, "statusCode": "200", "headers": { "headerName": "headerValue"}, "body": body});

Use path params in serverless framework 1.0

岁酱吖の 提交于 2020-01-23 05:35:12
问题 I want to use the path param /customer/{customerId} of a GET request in order to query a customer using AWS Lambda: functions: createCustomer: handler: handler.createCustomer events: - http: path: customer method: post readCustomer: handler: handler.readCustomer events: - http: path: customer method: get How do I have to define the path param in order to pass it to my AWS Lambda function using serverless framework 1.0 ? 回答1: Define in serverless.yml readCustomer: handler: handler.readCustomer

AWS API Gateway and Lambda to return image

倾然丶 夕夏残阳落幕 提交于 2020-01-23 04:42:11
问题 Say I have this HTML: <img src="http://example.com/pic"/> What I would like to do is have example.com/pic map to an AWS API Gateway endpoint. That endpoint would then call a lambda function. That lambda function would read a random image from an s3 bucket and return it. So my aim is to use a STANDARD HTML image tag and end up with an image from an s3 bucket but going via some decision code in the lambda to decide the image to return. I know you can use s3 to serve static content directly

Is it possible to modify AWS Cognito user attributes in the Lambda triggers

匆匆过客 提交于 2020-01-22 17:10:07
问题 Having a look at the AWS documentation, https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html#cognito-user-pools-lambda-trigger-syntax-pre-signup you have the following paramaters available in the Pre Sign-up Lambda fuction: "request": { "userAttributes": { "string": "string", .... }, "validationData": {<validation data as key-value (String, String) pairs, from the client>} is there a way to modify or add additional

aws-sam-local environment variables

南笙酒味 提交于 2020-01-22 13:15:45
问题 I am following the readme here: https://github.com/awslabs/aws-sam-local I have a lambda written in python 3.6 and its similar to the helloworld example here : https://github.com/awslabs/aws-sam-local/tree/develop/samples/hello-world/python template.yml looks as such: AWSTemplateFormatVersion : '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: MyFunction1 API Resources: MyFunction1: Type: AWS::Serverless::Function Properties: FunctionName: MyFunction1 Handler: lambda_module

AWS API Gateway with Lambda proxy always produces base64 string response

做~自己de王妃 提交于 2020-01-22 12:28:47
问题 I'm using API Gateway Lambda proxy integration and trying to return a binary application/protobuf response. No matter what I do, the response body is always a base64 encoded string I have application/protobuf setup as a binary media types in APIG My client (javascript) is sending following headers in the POST : Accept: application/protobuf Content-Type: application/protobuf My lambda is responing with content-type: application/protobuf , and correctly setting the IsBase64Encoded Lambda

AWS API Gateway with Lambda proxy always produces base64 string response

与世无争的帅哥 提交于 2020-01-22 12:28:08
问题 I'm using API Gateway Lambda proxy integration and trying to return a binary application/protobuf response. No matter what I do, the response body is always a base64 encoded string I have application/protobuf setup as a binary media types in APIG My client (javascript) is sending following headers in the POST : Accept: application/protobuf Content-Type: application/protobuf My lambda is responing with content-type: application/protobuf , and correctly setting the IsBase64Encoded Lambda

Create API gateway in localstack

本秂侑毒 提交于 2020-01-22 10:07:26
问题 I was able to setup localstack (https://github.com/atlassian/localstack) and also create lambda function in it (using create-function ... command). However, I couldnt find a way to create an APIGateway in localstack so that the lambda function can be called using it. Basically, I need an APIGateway(and its arn), so that using that the lambda function can be called. 回答1: Walkthrough for creating a NodeJS Lambda together with API Gateway per CLI: First we create a simple NodeJS Lambda: const

No response from any other intent request except Launch request

偶尔善良 提交于 2020-01-22 02:24:07
问题 I'm new to Alexa skill creation. I tried to create a skill for my term project in college and am trying to finish it. I've finally got the Lambda and interaction model communicating and am now testing the skill in the tool. I'm finding 2 issues. 1) The invocation name is sending me the unhandled response back, and 2) None of the intents outside of the launch intent are sending any response back. The Lambda code is as below: "use strict"; var Alexa = require("alexa-sdk"); var handlers = {