PnP-PowerShell icon indicating copy to clipboard operation
PnP-PowerShell copied to clipboard

[BUG] Add-PnPWebhookSubscription. Body empty.

Open BaronSparky opened this issue 4 years ago • 0 comments

Reporting an Issue or Missing Feature

When I call Add-PnPWebhookSubscription, the request body is empty (null) as received by my Azure Function (PowerShell)

Expected behavior

I would expect the "body" of the request to contain information relevant to the webhook subscription such as "ResourceId" and "WebId" to know where the subscription request came from

Actual behavior

The issue appears when trying to subscribe a list with an endpoint.

For example: Add-PnPWebhookSubscription -List somelist -NotificationUrl https://webhook.azurewebsites.net/api/handler -clientState Test

results in a Request object, received by my Azure Function (PowerShell HTTP Trigger) of: {"Body": null, "Headers": {"connection": "Keep-Alive", "content-length": "0", "host": "webhookfa.azurewebsites.net", "max-forwards": "9", "x-sharepoint-created-by": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientstate": "Test", "x-waws-unencoded-url": "/api/handler?validationtoken=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "client-ip": "x.x.x.x:x", "x-arr-log-id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "x-site-deployment-id": "WebHookFA", "was-default-hostname": "webhook.azurewebsites.net", "x-original-url": "/api/TiggerHandle?validationtoken=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "x-forwarded-for": "52.105.31.174:9051","x-arr-ssl": "2048|256|C=US, O=Microsoft Corporation, CN=Microsoft RSA TLS CA 01|CN=*.azurewebsites.net", "x-forwarded-proto": "https", "x-appservice-proto": "https", "x-forwarded-tlsversion": "1.2", "disguised-host": "webhook.azurewebsites.net"}, "Method": "POST", "Url": "https://webhook.azurewebsites.net/api/handler?validationtoken=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "Params": {}, "Query": {"validationtoken": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}, "RawBody": null}

The request object is fine with later webhook notifications as items change in the subscribed list.

Steps to reproduce behavior

Please include complete code samples in-line or linked from gists

Which version of the PnP-PowerShell Cmdlets are you using?

  • PnP.PowerShell

What is the version of the Cmdlet module you are running?

0.3.27

How did you install the PnP-PowerShell Cmdlets?

  • [ ] MSI Installed downloaded from GitHub
  • [x] Installed through the PowerShell Gallery with Install-Module
  • [ ] Other means

BaronSparky avatar Jan 06 '21 16:01 BaronSparky