pnp / PnP-PowerShell

SharePoint PnP PowerShell CmdLets
https://pnp.github.io/powershell
Other
990 stars 662 forks source link

[BUG] Add-PnPWebhookSubscription. Body empty. #3038

Open BaronSparky opened 3 years ago

BaronSparky commented 3 years ago

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?

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

0.3.27

How did you install the PnP-PowerShell Cmdlets?