-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.ts
77 lines (68 loc) · 1.49 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
import type { AWS } from '@serverless/typescript';
const serverlessConfiguration: AWS = {
app: 'app',
service: '${self:app}-api',
frameworkVersion: '3',
configValidationMode: 'error',
provider: {
name: 'aws',
runtime: 'nodejs20.x',
architecture: 'arm64',
memorySize: 512,
timeout: 29, // the maximum api gateway timeout is 29s
tags: {
developer: 'ian',
project: '${self:app}',
service: '${self:service}',
},
logRetentionInDays: 60,
environment: {
STAGE: '${sls:stage}',
NODE_OPTIONS: '--enable-source-maps',
},
iam: {
role: {
statements: [],
},
},
httpApi: {
cors: true,
},
},
functions: {
api: {
handler: 'src/lambda.handler',
// url: {
// cors: { allowCredentials: true },
// },
events: [
{
httpApi: '*',
},
],
},
},
package: {
individually: true,
},
// https://github.com/floydspace/serverless-esbuild
plugins: ['serverless-esbuild', 'serverless-offline'],
custom: {
esbuild: {
minify: true,
sourcemap: true,
packager: 'pnpm',
exclude: [],
},
},
};
const functions = serverlessConfiguration.functions;
for (const name in functions) {
if (Object.prototype.hasOwnProperty.call(functions, name)) {
const fn = functions[name];
if (fn.name === undefined) {
fn.name = `\${self:app}-\${sls:stage}-${name}`;
}
}
}
module.exports = serverlessConfiguration;