shibayan / keyvault-acmebot

Automated ACME SSL/TLS certificates issuer for Azure Key Vault (App Service / Container Apps / App Gateway / Front Door / CDN / others)
Apache License 2.0
912 stars 237 forks source link

Microsoft Teams webhook fails after certificate creation (reason: empty payload) #350

Closed diakonos closed 3 years ago

diakonos commented 3 years ago

Describe the bug Microsoft Teams webhook fails after certificate creation with error:

Failed invoke webhook. Status Code = BadRequest, Reason = Invalid webhook request - Empty Payload

To Reproduce Steps to reproduce the behavior:

  1. Follow setup instructions and configure a Microsoft Teams webhook.
  2. Create a new certificate.
  3. Search the application insights for "webhook".
  4. See webhook error that occurred after certificate creation.

Environment (please complete the following information):

Additional context I noticed that Teams recently changed the format of their webhook URL. It now has the format: https://xxx.webhook.office.com/webhookb2/xxx/IncomingWebhook/xxx/xxx. Previously it was: https://outlook.office.com/webhook/xxx/IncomingWebhook/xxx/xxx. I checked the source code for this project which seems to be looking for .office.com, so I don't believe the URL format change would negatively impact webhook execution.

shibayan commented 3 years ago

@diakonos Thanks for the report. Did you complete the issuance of the certificate correctly?

diakonos commented 3 years ago

@shibayan Yep, the certificate was issued successfully. Everything else besides the webhook seems to be behaving correctly so far.

shibayan commented 3 years ago

@diakonos Thanks. I was able to reproduce this in my environment and I will investigate and fix it.

GeorgDangl commented 3 years ago

Just FYI, I've got the same with MS teams, from Application Insights:

<html>
<body>
<!--StartFragment-->

Failed invoke webhook. Status Code = BadRequest, Reason = Invalid webhook request - Empty Payload |  
-- | --

<br class="Apple-interchange-newline"><!--EndFragment-->
</body>
</html>
GeorgDangl commented 3 years ago

And as far as I remember, it never worked for me. My main subscription is pushing to Slack, but this one was recently set up a few weeks ago and I've set up a teams webhook.

shibayan commented 3 years ago

Thank you. I was able to identify the cause.

It seems that Incoming Webhook in Teams does not handle requests with Transfer-Encoding correctly. I'm working on a fix to avoid this problem now.

shibayan commented 3 years ago

This issue has been fixed in v3.6.6. Thank you!