aws-serverless

How to add a custom folder and file via YAML in Serverless app

被刻印的时光 ゝ 提交于 2019-12-11 12:45:59
问题 I am writing a serverless app by using SAM. I created a config folder to keep some table information and some other info. then I load it in my app.js. when I deploy the app.js locally by using SAM deploy, I observe that the config folder will not include. would you mind advise me how to add config folder in final build folder in .aws-sam\build folder? my Yaml file AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: Sample SAM Template for test Globals:

Could not get the syntax of policy definition in SAM template resource(serverless function)

会有一股神秘感。 提交于 2019-12-11 09:47:49
问题 Policy definition of AWS managed policy ( AWSLambdaExecute ) is: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:*" ], "Resource": "arn:aws:logs:*:*:*" }, { "Effect": "Allow", "Action": [ "s3:GetObject", "s3:PutObject" ], "Resource": "arn:aws:s3:::*" } ] } But the AWS_documentation gives a sample serverless function using the same policy name AWSLambdaExecute , as shown below: Type: AWS::Serverless::Function Properties: Handler: index.js Runtime: nodejs8.10

Native Serverless vs Serverless Express

会有一股神秘感。 提交于 2019-12-11 06:07:50
问题 Right now, I am following a guide prepared from Serverless Stack Team. They are using React and lots of AWS features like lambda and API getaway . In order to practice it, I am re-writing one of my old Express example with the Serverless stack. I also saw a library or tool called aws-serverless-express . This library or tool allows you to run your express app in a way that serverless form. It will be a weird question, but I was wondering the difference between native serverless build and

AWS serverless function is not responding with an image

倖福魔咒の 提交于 2019-12-11 04:13:02
问题 I'm trying to have AWS API Gateway respond back with an image. My Serverless Lambda code is the following const express = require('express'); const serverless = require('serverless-http'); const bodyParser = require('body-parser'); const request = require('request'); const fetch = require('node-fetch') var Jimp = require('jimp'); const app = express() app.use(bodyParser.json()) app.use(bodyParser.urlencoded({ extended: true })) app.get('/image/:id', async(req, res) => { const id = req.params

Badge count option in amazon SNS

烂漫一生 提交于 2019-12-10 16:26:38
问题 I need to get badge count in my application. I am using amazon SNS service. Here is my code AWS.config.update({ accessKeyId: 'XXXXXXX', secretAccessKey: 'XXXXXXX' }) AWS.config.update({ region: 'XXXXXXX' }) const sns = new AWS.SNS() const params = { PlatformApplicationArn: 'XXXXXXX', Token: deviceToken } sns.createPlatformEndpoint(params, (err, EndPointResult) => { const client_arn = EndPointResult["EndpointArn"]; sns.publish({ TargetArn: client_arn, Message: message, Subject: title, // badge

AWS API Gateway with custom authorizer returns AuthorizerConfigurationException

别来无恙 提交于 2019-12-08 02:09:50
问题 I have an AWS API Gateway that uses a custom authorizer, and if the request is authorized, it triggers another lambda function. Since yesterday, whenever I call the API, I get an error saying { "message": null } and a 500 Internal Server Error. In the response headers it says x-amzn-ErrorType →AuthorizerConfigurationException . I can see in the logs that the authorizer is called and returns a valid policy, and that the other lambda function is not triggered. I have not (knowingly) changed the

AWS API Gateway with custom authorizer returns AuthorizerConfigurationException

我怕爱的太早我们不能终老 提交于 2019-12-06 09:06:19
I have an AWS API Gateway that uses a custom authorizer, and if the request is authorized, it triggers another lambda function. Since yesterday, whenever I call the API, I get an error saying { "message": null } and a 500 Internal Server Error. In the response headers it says x-amzn-ErrorType →AuthorizerConfigurationException . I can see in the logs that the authorizer is called and returns a valid policy, and that the other lambda function is not triggered. I have not (knowingly) changed the authorizer. Can anyone give me a hint what might be wrong here? I have read this question but there

How do you package up a visual studio aws serverless project?

↘锁芯ラ 提交于 2019-12-06 07:24:17
问题 I'm trying to figure out if there is a way I can package up an aws serverless project in an automated way so that we can split our build and release pipeline up. Using the dotnet lambda command line tools, I can see there is a dotnet lambda package command to package the lambda as a .zip file ready for deployment. But I can't find anything for packaging the whole serverless application up. Is this possible? If so what commands do I run? We're running on VSTS for the Build and Release

Create an API Gateway Proxy Resource using SAM

限于喜欢 提交于 2019-12-04 16:03:15
I have an apparently-simple requirement to create a proxy resource in SAM (Amazon's Serverless Application Model). So simple in fact that Amazon's documentation appears to leave this as an exercise to the reader! I want to create an AWS API Gateway catch-all endpoint to proxy everything to another HTTP service. In the AWS Console, the configuration I am trying to build looks as follows: I have seen this excellent post by Christian Johansen and his related Stack Overflow question here for how to do the same thing in CloudFormation. I suppose I could just use that code in SAM, however, SAM has

How do you package up a visual studio aws serverless project?

青春壹個敷衍的年華 提交于 2019-12-04 12:45:00
I'm trying to figure out if there is a way I can package up an aws serverless project in an automated way so that we can split our build and release pipeline up. Using the dotnet lambda command line tools, I can see there is a dotnet lambda package command to package the lambda as a .zip file ready for deployment. But I can't find anything for packaging the whole serverless application up. Is this possible? If so what commands do I run? We're running on VSTS for the Build and Release pipelines, however I don't really think I makes any difference as long as I can script it out. Looks like this