serverless-framework

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:

serverless - How to add multiple files to iamRoleStatements?

房东的猫 提交于 2021-01-28 06:02:17
问题 In my serverless.yml file, I want to be able to add iamRoleStatements from two differents files (this cannot change). So I tried doing it like this: provider: iamRoleStatements: - ${file(__environments.yml):dev.iamRoleStatements, ''} - ${file(custom.yml):provider.iamRoleStatements, ''} Each of these files have an iamRoleStatements section. __environments.yml: dev: iamRoleStatements: - Effect: 'Allow' Action: 'execute-api:Invoke' Resource: '*' custom.yml: provider: iamRoleStatements: - Effect:

Allow serverless lambda to be called by cloud watch

和自甴很熟 提交于 2021-01-28 05:45:16
问题 I have one lambda function within my serverless.yml . It looks somehow like this: functions: clean: handler: app.run events: - schedule: rate(2 hours) It works pretty well and out of the box lambda gets called every 2 hours. When I add new rule in AWS Console and sets the newly created lambda as a target it also works. Both AWS Console and Serverless framework creates on the background policy that events.amazonaws.com service can invoke this specific function. The policy looks somehow like

Serverless does not create SQS events

笑着哭i 提交于 2021-01-28 01:56:01
问题 I am trying to make serverless create a trigger to fire whenever an object queues. But it does not create and also does not fire any errors. My serverless.yml: I did according to the documentation (https://serverless.com/framework/docs/providers/aws/events/sqs/) service: lambda-messages provider: name: aws runtime: nodejs8.10 stage: dev region: us-east-1 memorySize: 256 iamRoleStatements: - Effect: "Allow" Action: - sqs:SendMessage - sqs:ReceiveMessage - sqs:DeleteMessage - sqs

Adding XRAY Tracing to non-rest functions e.g., SQS, Cognito Triggers etc

假装没事ソ 提交于 2021-01-27 12:39:18
问题 Using the Serverless framework, I have functions that aren’t attached to an API Gateway Endpoint, such as: Cognito Triggers S3 Event DynamoDB Stream SQS Events I am also using XRAY tracing, which I have set as tracing: true in my serverless.yml file. It seems that these functions are not being traced, the debug message I receive is: Ignoring flush on subsegment 20dcd559aa2ab487. Associated segment is marked as not sampled. Is there any way to have these functions added, either via serverless

Adding XRAY Tracing to non-rest functions e.g., SQS, Cognito Triggers etc

廉价感情. 提交于 2021-01-27 12:34:51
问题 Using the Serverless framework, I have functions that aren’t attached to an API Gateway Endpoint, such as: Cognito Triggers S3 Event DynamoDB Stream SQS Events I am also using XRAY tracing, which I have set as tracing: true in my serverless.yml file. It seems that these functions are not being traced, the debug message I receive is: Ignoring flush on subsegment 20dcd559aa2ab487. Associated segment is marked as not sampled. Is there any way to have these functions added, either via serverless

How to reference Arn and name of AWS lambda function created with Serverless Framework

青春壹個敷衍的年華 提交于 2021-01-05 07:22:08
问题 I am using the Serverless Framework to create a lambda function and would like to be able to cross-reference its Arn and name in other parts of serverless.yml. I'm surprised how difficult I'm finding this as !GetAtt and !Ref do not seem to work as I would expect if the lambda was created via vanilla CloudFormation. (AWS::Lambda::Function returns Ref and Fn::GetAtt which would make this easy!) I have found a few posts, that allude to solutions, but nothing that states in plain English how to

How to reference Arn and name of AWS lambda function created with Serverless Framework

别说谁变了你拦得住时间么 提交于 2021-01-05 07:21:04
问题 I am using the Serverless Framework to create a lambda function and would like to be able to cross-reference its Arn and name in other parts of serverless.yml. I'm surprised how difficult I'm finding this as !GetAtt and !Ref do not seem to work as I would expect if the lambda was created via vanilla CloudFormation. (AWS::Lambda::Function returns Ref and Fn::GetAtt which would make this easy!) I have found a few posts, that allude to solutions, but nothing that states in plain English how to

QueryString parameters are not getting validated even after setting the params to be required in serverless yaml

夙愿已清 提交于 2020-12-29 06:01:34
问题 I've configured API gateway via lambda function deployed with serverless framework. I've defined some queryStringParameters to be true in the yaml file. But the request is passing through the service even when the Required(mandatory) queryStringParams are not passed in URL. PFB the similar config. functions: functionName: name: serviceName handler: handler.handle events: - http: path: /path method: get request: parameters: querystrings: param1: true param2: true Seems serverless is not