Serverless

Invoke a lambda function with deployment using serverless framework

对着背影说爱祢 提交于 2019-12-07 05:04:35
问题 Is there a way to invoke a lambda function immediately after deployment using serverless framework. This function just creates the SNS Application, which is required to be done once only during setup. I can use serverless deploy stage && serverless invoke --function functionName but that won't tear down the setup if the function fails. I want it to be deployed as part of setup. Thanks 回答1: Hooks can be added to the lifecycle events of the Serverless framework. I used serverless-plugin-scripts

Multiple serverless files sharing the same api gateway

懵懂的女人 提交于 2019-12-07 01:00:28
问题 I am using serverless framework to build a REST API. I have reached the 200 limit stack size and read about the multiple approaches to circumvent it. The most common approach is to split the stacks in a "microservices fashion", where each stack handles a particular set of resources that make sense together. Because of how serverless works each of those services would create a new api gateway for itself and then, as explained in this blog post, a shared domain can be setup between them so all

Connect to Aurora Serverless using EC2 as Proxy

妖精的绣舞 提交于 2019-12-06 11:24:37
问题 Not a duplicate of AWS Aurora MySQL serverless: how to connect from MySQL Workbench. Aurora Serverless doesn't support public connections yet. I used Cloud9 to create an EC2 instance on the same VPN as the database. I then connected to the database from the Cloud9 terminal. My (GraphQL Prisma) service that I'm attempting to host (on Zeit Now) only takes a HOST and a PASSWORD for configuration. How can I make the EC2 instance act as a proxy that I can treat exactly as a database endpoint. Can

now-cli deployment doesn't build package.json dependencies

自闭症网瘾萝莉.ら 提交于 2019-12-06 09:44:28
I'm trying to deploy a Sapper built application via @now-node . The task is basically to deploy a Polka server with dependencies and to serve static/ and client/ files statically. I have managed to include the files that Lambda requires via includeFiles but now I see in the logs that the builder ignores dependencies described in package.json. The exact message is Starting server on port 3000 Cannot find module 'sirv' Did you forget to add it to "dependencies" in `package.json`? But I see in the build log that dependencies are not collected. Both package.json and package-lock.json are present

Cloud functions timeout on page.goto()

好久不见. 提交于 2019-12-06 09:36:38
I run tests with puppeteer in cloud functions. If I run test on local machine all is fine. If I run tests in cloud functions emulator it's fine as well. But when I deploy my function to the cloud all tests stuck on page.goto('https://...') and function fails by timeout, which in my case is 3 minutes. The problem was in puppeteer. I downgraded from the version 1.13.0 to 1.11.0 and now everything works fine. See the discussion here 来源: https://stackoverflow.com/questions/55274130/cloud-functions-timeout-on-page-goto

How to fix CloudRun error 'The request was aborted because there was no available instance'

孤者浪人 提交于 2019-12-06 08:42:47
问题 I'm using managed CloudRun to deploy a container with concurrency=1 . Once deployed, I'm firing four long-running requests in parallel. Most of the time, all works fine -- But occasionally, I'm facing 500's from one of the nodes within a few seconds; logs only provide the error message provided in the subject. Using retry with exponential back-off did not improve the situation; the retries also end up with 500s. StackDriver logs also do not provide further information. Potentially relevant

How to use Typescript's references and build mode to compile a mono repo to a serverless bundle?

旧时模样 提交于 2019-12-06 06:45:00
Typescript recently introduced a new feature to work with monorepos: references. By specifying references you can build all interdependent packages using tsc -b (see also this blog post ) This seems ideal for use with a large mono repo where some packages are serverless services. These services typically depend on one or more packages of the monorepo. I've created an example here: https://github.com/tommedema/serverless-mono-example While building works well with tsc -b , the problem is that the serverless framework needs to upload a single artifact .zip (to AWS in my case). When building a

authentication in mobile app with azure functions

独自空忆成欢 提交于 2019-12-06 06:00:45
问题 I am trying to develop a serverless backend for my xamarin app. and for that I chose azure functions . Now I already know that Azure Mobile Apps provide an SDK for this purpose with which we can easily enable Authentication with multiple ways which are following 1. Azure Active Directiry 2. Facebook 3. Google 4. Microsoft 5. Twitter Now I want to allow login with atleast 2 of these in my app, but I am not using azure mobile app as backend, instead I am using azure functions. So how can I

AWS Lambda: Identifying cold starts

孤者浪人 提交于 2019-12-06 05:51:25
问题 Is there a clear way to identify "cold starts"? Either in runtime in the Lambda itself, or via the logs? I know that cold starts are characterized by longer runtimes, which I can actually see, but I'm looking for a clear cut way. I'm using Node.js if that matters. Update: There are two good answers below, for two use cases: - Identifying the cold start as the lambda runs. - Identifying the cold start from the CloudWatch log. 回答1: If you add some initialization code to the top of your NodeJS

Not able to add policies in SAM template

可紊 提交于 2019-12-06 00:52:47
问题 I am working on SAM template for publishing my Application in AWS Serverless repository. But when I try to add policies for my lambda it shows me error: Invalid Serverless Application Specification document. Number of errors found: 1. Errors: Resource with id [SyncPostDataFromSfLambda] is invalid. Only policy templates are supported in 'Policies' property. Below is the example for my SAM template: { "AWSTemplateFormatVersion": "2010-09-09", "Transform": "AWS::Serverless-2016-10-31",