Skip to content

Commit

Permalink
Fix webhook resource
Browse files Browse the repository at this point in the history
  • Loading branch information
nightfury1204 committed Aug 29, 2024
1 parent 317a496 commit ba9b94d
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions provider/aws/templates/resource/webhook.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,24 @@
"var https = require(\"https\");",
"var url = require(\"url\");",
"exports.handler = (event, context, cb) => {",
" var req = https.request(Object.assign(url.parse(process.env.WEBHOOK_URL), { method:\"POST\" }), function(res) {;",
" cb(null);",
" var req = https.request(",
" Object.assign(url.parse(process.env.WEBHOOK_URL), { method: \"POST\" }),",
" function (res) {",
" let data = '';",
" res.on('data', (chunk) => {",
" data += chunk;",
" });",
" res.on('end', () => {",
" cb(null, 200);",
" });",
" }",
" );",
" req.on('error', (e) => {",
" cb(e);",
" });",
" req.write(event.Records[0].Sns.Message);",
" req.end();",
"}"
"};"
] ] }
},
"Environment": { "Variables": { "WEBHOOK_URL": { "Ref": "Url" } } },
Expand Down

0 comments on commit ba9b94d

Please sign in to comment.