Skip to content

Commit

Permalink
Adding user agent otherwise we get a 403 Forbidden error (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
sylviamclaughlin authored Jun 14, 2024
1 parent 26983ab commit c29f148
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const orgClient = new OrganizationsClient({ region: "us-east-1" });
const https = require('https')

exports.handler = async (event) => {
const hook = event.hook;
const hook = event.hook;
const today = new Date();

// call the daily cost function to get daily costs
Expand Down Expand Up @@ -109,17 +109,19 @@ exports.handler = async (event) => {
"blocks": blocks
}
)

const options = {
hostname: 'sre-bot.cdssandbox.xyz',
port: 443,
path: `/hook/${hook}`,
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length
'Content-Length': data.length,
'User-Agent':'AWS_Lambda_Cost_Notifier_Function (Node.js)' // Set User-Agent header
}
}

const resp = await doRequest(options, data);
console.log(resp)

Expand Down

0 comments on commit c29f148

Please sign in to comment.