-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.ts
78 lines (75 loc) · 1.65 KB
/
serverless.ts
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
76
77
78
import type { AWS } from '@serverless/typescript'
import { env } from './config/env'
const { prod, staging } = env
const current = process.env.AWS_PROFILE === 'prod' ? prod : staging
const serverlessConfiguration: AWS = {
service: 'WhatsAppBot',
useDotenv: true,
frameworkVersion: '3',
custom: {
'serverless-layers': {
dependenciesPath: './package.json'
},
webpack: {
webpackConfig: './webpack.config.js',
includeModules: false
},
'serverless-offline': {
noPrependStageInUrl: true
},
ngrokTunnel: {
tunnels: {
port: 3000,
envProp: 'API_GATEWAY'
}
}
},
plugins: [
'serverless-webpack',
'serverless-layers',
'serverless-aws-latest-layer-version',
'serverless-offline',
'serverless-ngrok-tunnel'
],
provider: {
stage: current.stage,
name: 'aws',
region: current.region,
runtime: 'nodejs16.x',
iam: {
role: 'arn:aws:iam::016120380681:role/LambdaS3Trainning'
},
deploymentBucket: current.deploymentBucket,
environment: {
AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1'
},
lambdaHashingVersion: '20201221'
},
functions: {
job: {
name: 'SendReminder',
handler: 'src/index.job',
events: [
{
schedule: {
rate: ['cron(0 8,12,14,17 * * ? *)']
}
}
]
},
handler: {
name: 'HandleMessageRequests',
handler: 'src/index.handler',
events: [
{
http: {
path: '/{proxy+}',
method: 'ANY',
cors: false
}
}
]
}
}
}
module.exports = serverlessConfiguration