This repository has been archived by the owner on Jul 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
75 lines (66 loc) · 2.32 KB
/
serverless.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# CloudFormation output name: `sls-${SERVICE_NAME}-${STAGE}`
service: sls-${self:custom.service}
custom:
service: ${env:SERVICE_NAME}
region: ${opt:region, env:AWS_REGION}
stage: ${opt:stage, env:STAGE}
apikey: ${env:API_KEY_SECRET}
# **WARNING: Brittle**: This is unused and just a hack to force the serverless
# build to fail if API_KEY_SECRET is not present in the environment.
# What we _want_ is for serverless to fail on `apikey` being empty above. But
# it will only warn. By doing a contatenation here, this unused variable
# becomes a canary that fails the entire build if API_KEY_SECRET is missing.
apikey-required: ${env:API_KEY_SECRET}-required
jetpack:
preInclude:
- "!**" # Start with absolutely nothing
trace:
ignores:
- aws-sdk # Provide in lambda
dynamic:
resolutions:
# Express dynamically imports view engines, which you can ignore if
# unused or add it specifically here or in an `include`.
#
# - [81:13]: require(mod)
#
"express/lib/view.js": false
package:
include:
# Need public directory manual inclusion for web page.
- "public/**"
# Non-traceable dependency files
# See: https://github.com/FormidableLabs/trace-deps/issues/16
- "node_modules/errorhandler/public/**"
plugins:
- serverless-offline
- serverless-jetpack
provider:
name: aws
# Required: import the default role that terraform-aws-serverless generates.
role:
Fn::ImportValue: tf-${self:custom.service}-${self:custom.stage}-LambdaExecutionRoleArn
# Lambda configuration
runtime: nodejs12.x
timeout: 30 # seconds (`300` max)
memorySize: 128 # MB value (`1024` default)
# Deployment / environment configuration
region: ${self:custom.region}
stage: ${self:custom.stage}
environment:
STAGE: ${self:custom.stage}
SERVICE_NAME: ${self:custom.service}
API_KEY_SECRET: ${self:custom.apikey}
# AWS Resource Tags: Match terraform module
stackTags: # For CF stack
Stage: ${self:custom.stage}
Service: ${self:custom.service}
tags: # For resources
Stage: ${self:custom.stage}
Service: ${self:custom.service}
functions:
server:
handler: src/server/index.handler
events: # Use a generic proxy to allow Express app to route.
- http: ANY /
- http: 'ANY /{proxy+}'