forked from guerrerocarlos/voiceTranscriptionBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.ts
82 lines (79 loc) · 2.16 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
79
80
81
82
import type { AWS } from "@serverless/typescript";
import * as dotenv from "dotenv";
import telegram from "@functions/telegram";
import main from "@functions/main";
dotenv.config();
const serverlessConfiguration: AWS = {
service: "voicebot",
frameworkVersion: "2",
custom: {
webpack: {
webpackConfig: "./webpack.config.js",
includeModules: {
forceExclude: ["aws-sdk"],
},
},
},
plugins: ["serverless-webpack"],
provider: {
name: "aws",
runtime: "nodejs14.x",
region: "us-east-2",
apiGateway: {
minimumCompressionSize: 1024,
shouldStartNameWithService: true,
},
timeout: 120,
environment: {
AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1",
BOT_TOKEN: process.env.BOT_TOKEN,
TRANSCRIPTION_S3_BUCKET: process.env.TRANSCRIPTION_S3_BUCKET,
TEMP_STORAGE_FOLDER: process.env.TEMP_STORAGE_FOLDER,
WIT_TOKEN: process.env.WIT_TOKEN,
GC_BUCKET: process.env.GC_BUCKET,
GC_CREDENTIALS: process.env.GC_CREDENTIALS,
},
deploymentBucket: {
name: "deployment-bucket-us-east-2",
},
lambdaHashingVersion: "20201221",
iam: {
role: {
statements: [
{
Effect: "Allow",
Action: ["lambda:InvokeFunction"],
Resource: ["*"],
},
{
Effect: "Allow",
Action: ["s3:ListBucket"],
Resource: "arn:aws:s3:::idiomasconliza.com",
},
{
Effect: "Allow",
Action: ["s3:PutObject"],
Resource: "arn:aws:s3:::idiomasconliza.com/*",
},
{
Effect: "Allow",
Action: ["s3:GetObject"],
Resource: "arn:aws:s3:::idiomasconliza.com/*",
},
{
Effect: "Allow",
Action: [
"transcribe:StartTranscriptionJob",
"transcribe:GetTranscriptionJob",
],
Resource:
"arn:aws:transcribe:us-east-2:149962407454:transcription-job/*",
},
],
},
},
},
// import the function via paths
functions: { telegram, main },
};
module.exports = serverlessConfiguration;