serverless-framework

API Gateway HTTP Proxy integration with serverless-offline (NOT Lambda Proxy)

你说的曾经没有我的故事 提交于 2019-12-01 20:15:27
I am trying to use serverless-offline to develop / simulate my API Gateway locally. My API gateway makes liberal use of the HTTP proxy integrations . The production Resource looks like this: I have created a serverless-offline configuration based on a few documents and discussion which say that it is possible to define an HTTP Proxy integration using Cloud Formation configuration: httpProxyWithApiGateway.md - Setting an HTTP Proxy on API Gateway by using Serverless framework. Setting an HTTP Proxy on API Gateway (official Serverless docs: API Gateway) I have adapted the above two configuration

Mirror a Git Repo directly to AWS CodeCommit

人盡茶涼 提交于 2019-12-01 18:00:54
I want to create a backup of one fo my Git Repository and save it to AWS CodeCommit. I don't want to include the use of my local machine. Can anyone tell me how can I do it directly or through AWS Lambda? Joey H I just started searching for the answer to this very question. Before I post some of my preliminary data have you found a solution to this? Here is what I have found so far: BitBucket https://github.com/ef-labs/stash-hook-mirror GitHub https://github.com/gitbucket/gitbucket/issues/833 https://help.github.com/articles/about-webhooks/ JGit https://fancybeans.com/2012/08/24/how-to-use-s3

Mirror a Git Repo directly to AWS CodeCommit

早过忘川 提交于 2019-12-01 17:39:10
问题 I want to create a backup of one fo my Git Repository and save it to AWS CodeCommit. I don't want to include the use of my local machine. Can anyone tell me how can I do it directly or through AWS Lambda? 回答1: I just started searching for the answer to this very question. Before I post some of my preliminary data have you found a solution to this? Here is what I have found so far: BitBucket https://github.com/ef-labs/stash-hook-mirror GitHub https://github.com/gitbucket/gitbucket/issues/833

How do I deploy a function in python with its dependencies?

故事扮演 提交于 2019-12-01 17:07:24
I'm trying to use the serverless framework to create and deploy an AWS Lambda function. I created a folder named vendored in the root of the project and installed (using pip install ) the function dependencies. However, whenever I try to run it (using serverless function run ) I got an error: Serverless: Running isNewUser... Serverless: WARNING: This variable is not defined: region Serverless: ----------------- Serverless: Failed - This Error Was Returned: Serverless: {"exception": ["Traceback (most recent call last):\n", " File \"/home/fernando/.nvm/versions/node/v5.10.1/bin/serverless-run

How do I deploy a function in python with its dependencies?

[亡魂溺海] 提交于 2019-12-01 15:57:38
问题 I'm trying to use the serverless framework to create and deploy an AWS Lambda function. I created a folder named vendored in the root of the project and installed (using pip install ) the function dependencies. However, whenever I try to run it (using serverless function run ) I got an error: Serverless: Running isNewUser... Serverless: WARNING: This variable is not defined: region Serverless: ----------------- Serverless: Failed - This Error Was Returned: Serverless: {"exception": [

custom authorizers in Amazon API Gateway 500 error

孤街醉人 提交于 2019-12-01 05:41:46
I use Serverless-Authentication-boilerplate and want to map custom error response. But it always return 500 error. authorize.js // Authorize function authorize(event, callback) { let providerConfig = config(event); try { let data = utils.readToken(event.authorizationToken, providerConfig.token_secret); console.log("Decrypted data: " + JSON.stringify(data)); let methodArn = event.methodArn.replace(/(GET|POST|PUT|DELETE)/g, '*').replace(/mgnt.+/g, 'mgnt/*'); console.log(`Change methodArn to: ${methodArn}`); // TODO: handle expiration time validation callback(null, utils.generatePolicy( data.id,

Number of active connections on the server reached to max

故事扮演 提交于 2019-12-01 05:12:29
I am working with mongodb and nodejs. I have mongodb hosted on Atlas. My backend had been working perfectly but now it is sometimes getting stuck and when I see the analytics on mongodb atlas it shows maximum number of active connections reached to 100 . Can someone please explain why this is happening? Can I reboot the connections and make it 0 ? @Stennie I have used mongoose to connect to database Here is my configuration file const mongooseOptions = { useNewUrlParser: true, autoReconnect: true, poolSize: 25, connectTimeoutMS: 30000, socketTimeoutMS: 30000 } exports.register = (server,

Number of active connections on the server reached to max

情到浓时终转凉″ 提交于 2019-12-01 02:54:26
问题 I am working with mongodb and nodejs. I have mongodb hosted on Atlas. My backend had been working perfectly but now it is sometimes getting stuck and when I see the analytics on mongodb atlas it shows maximum number of active connections reached to 100 . Can someone please explain why this is happening? Can I reboot the connections and make it 0 ? @Stennie I have used mongoose to connect to database Here is my configuration file const mongooseOptions = { useNewUrlParser: true, autoReconnect:

Request validation using serverless framework

霸气de小男生 提交于 2019-11-30 19:34:48
I am using serverless framework for the backend. How can I implement request validation? (do not want to write validation inside lambda functions). To implement request validation using serverless you need to do a couple of things: Include your model/header definitions in your stack, and then tell API gateway to use them for request validation. You'll need to install the following packages: serverless-aws-documentation serverless-reqvalidator-plugin And then you'll need to include them in your serverless.yml : plugins: - serverless-reqvalidator-plugin - serverless-aws-documentation Note: below

AWS Lambda fails to return PDF file

匆匆过客 提交于 2019-11-30 19:09:25
I have created a lambda function using serverless . This function is fired via API Gateway on a GET request and should return a pdf file from a buffer. I'm using html-pdf to create the buffer and trying to return the pdf file with the following command let response = { statusCode: 200, headers: {'Content-type' : 'application/pdf'}, body: buffer.toString('base64'), isBase64Encoded : true, }; return callback(null, response); but the browser is just failing to load the pdf, so I don't know exactly how to return the pdf file directly to the browser. Could'nt find a solution for that. well, I found