Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const startWebhookCallTime = process.hrtime();
const sendResult = await sendToWebhook(
webhookNotification.url,
message,
content,
senderMetadata
);
const webhookCallDurationMs = diffInMilliseconds(startWebhookCallTime);
const eventName = "notification.webhook.delivery";
// hide backend secret token in logs
const hostName = UrlFromString.decode(webhookNotification.url).fold(
_ => "invalid url",
url => url.hostname || "invalid hostname"
);
const eventContent = {
data: hostName,
dependencyTypeName: "HTTP",
duration: webhookCallDurationMs,
name: eventName
};
if (isLeft(sendResult)) {
const error = sendResult.value;
// track the event of failed delivery
lAppInsightsClient.trackDependency({
...eventContent,