Skip to content

Commit 01f2942

Browse files
committed
Upgrade nodejs lambda runtime to 22.x
1 parent 27ba5c1 commit 01f2942

File tree

4 files changed

+25
-23
lines changed

4 files changed

+25
-23
lines changed

provider/aws/formation/app.json.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@
447447
"Properties": {
448448
"Handler": "index.handler",
449449
"Role": { "Fn::GetAtt": [ "TimerRole", "Arn" ] },
450-
"Runtime": "nodejs20.x",
450+
"Runtime": "nodejs22.x",
451451
"Timeout": 60,
452452
"Code": {
453453
"ZipFile": { "Fn::Join": [ "\n", [

provider/aws/formation/g1/app.json.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@
200200
"Handler": "index.external",
201201
"MemorySize": "128",
202202
"Role": { "Fn::GetAtt": [ "CustomTopicRole", "Arn" ] },
203-
"Runtime": "nodejs20.x",
203+
"Runtime": "nodejs22.x",
204204
"Timeout": "300"
205205
}
206206
},

provider/aws/formation/rack.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1371,7 +1371,7 @@
13711371
"Handler": "index.external",
13721372
"MemorySize": "128",
13731373
"Role": { "Fn::GetAtt": [ "CustomTopicRole", "Arn" ] },
1374-
"Runtime": "nodejs20.x",
1374+
"Runtime": "nodejs22.x",
13751375
"Timeout": "300",
13761376
"VpcConfig": { "Fn::If": [ "PrivateAndPlaceLambdaInVpc",
13771377
{

provider/aws/templates/resource/webhook.tmpl

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,35 @@
1616
"Properties": {
1717
"Code": {
1818
"ZipFile": { "Fn::Join": [ "\n", [
19-
"var https = require(\"https\");",
20-
"var url = require(\"url\");",
21-
"exports.handler = (event, context, cb) => {",
22-
" var req = https.request(",
23-
" Object.assign(url.parse(process.env.WEBHOOK_URL), { method: \"POST\" }),",
24-
" function (res) {",
25-
" let data = '';",
26-
" res.on('data', (chunk) => {",
27-
" data += chunk;",
28-
" });",
29-
" res.on('end', () => {",
30-
" cb(null, 200);",
31-
" });",
32-
" }",
33-
" );",
34-
" req.on('error', (e) => {",
35-
" cb(e);",
19+
"const https = require(\"https\");",
20+
"const url = require(\"url\");",
21+
"exports.handler = async (event) => {",
22+
" return new Promise((resolve, reject) => {",
23+
" const req = https.request(",
24+
" Object.assign(url.parse(process.env.WEBHOOK_URL), { method: \"POST\" }),",
25+
" (res) => {",
26+
" let data = '';",
27+
" res.on('data', (chunk) => {",
28+
" data += chunk;",
29+
" });",
30+
" res.on('end', () => {",
31+
" resolve(200);",
32+
" });",
33+
" }",
34+
" );",
35+
" req.on('error', (e) => {",
36+
" reject(e);",
37+
" });",
38+
" req.write(event.Records[0].Sns.Message);",
39+
" req.end();",
3640
" });",
37-
" req.write(event.Records[0].Sns.Message);",
38-
" req.end();",
3941
"};"
4042
] ] }
4143
},
4244
"Environment": { "Variables": { "WEBHOOK_URL": { "Ref": "Url" } } },
4345
"Handler": "index.handler",
4446
"Role": { "Fn::GetAtt": [ "ForwarderRole", "Arn" ] },
45-
"Runtime": "nodejs20.x",
47+
"Runtime": "nodejs22.x",
4648
"Timeout": "10"
4749
}
4850
},

0 commit comments

Comments
 (0)