question

AntonioReyes-6388 avatar image
0 Votes"
AntonioReyes-6388 asked MayankBargali-MSFT commented

Unable to create Event Grid Subscriptions for a Custom Topic and with Webhook as Endpoint Type

Hello!

I'm unable to create subscriptions for a Custom Topic in Event Grid. I'm trying to use Webhook as my endpoint type. I'm also using the Event Grid Schema.

I'm getting the following error:

Deployment has failed with the following error: {"code":"Url validation","message":"Webhook validation handshake failed for https://fapp-testo.azurewebsites.net/api/HttpTrigger1. Http POST request failed with response code Unknown. Activity id:9f95a3a1-0574-417c-bf0a-53488457347a, timestamp: 10/7/2020 8:59:16 PM (UTC)."}

For troublehooting, visit https://aka.ms/esvalidation.

  • I have enabled System Assigned Identity

  • I also enabled system assigned identity for dead-lettering

Sometimes it works and I'm able to see the subscription listed within my Custom Topic, But after a few seconds it goes away.

What I´m trying to achieve is from my application call my Custom Event Grid Topic so it can trigger some HTTPS Azure Function I have, (this as webhooks).

Please help.

Thank you

azure-event-grid
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @AntonioReyes-6388

Following up to see if my answer helps. Do let me know if you any queries.

0 Votes 0 ·

Hi @AntonioReyes-6388

I hope the answer helps. Please let me know if you any further queries.

0 Votes 0 ·
MayankBargali-MSFT avatar image
0 Votes"
MayankBargali-MSFT answered SantoshMashettiExternal-4768 commented

Hi @AntonioReyes-6388

Looking into backend logs I can see that the validation failed as the function app was returning 500 error.
Below exception is observed at function app:

Microsoft.CSharp.RuntimeBinder.RuntimeBinderException : 'Newtonsoft.Json.Linq.JArray' does not contain a definition for 'name'
at CallSite.Target(Closure ,CallSite ,Object )
at async Submission#0.Run(HttpRequest req,ILogger log) at D:\home\site\wwwroot\HttpTrigger1\run.csx : 0

Looks like there is an issue in parsing the JSON value that you have received from the event grid. You need to look into your code and test your function app first to resolves the above error. Once the above error is resolved you can then configure this function app to your event grid subscription.

Further, I can see that you have the function name 'Httpxxx' is of type HttpTrigger and when you have configured the event grid with function app HTTP trigger than you need to write the code (you need to customize the code according to your need) for validating the webhook and looks like that is getting failed while parsing the validation event json. If you are using EventGrid trigger than the Azure infrastructure automatically handles this validation.

Hope the above helps. Feel free to get back to me if you need any assistance.

Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello Mayank.

It seems to be an issue with the code structure. I been reading the documentation and the error logs coming from the webhooks and everything points to the code it self.

Also, as you mentioned, the issue also has to be with the type of trigger, in this case HTTP. Is there a way to make an HTTP Trigger Function like a Event Grid Trigger one?

It will be great if there is an article/documentation on how to add HTTP Trigger function as webhooks to an Event Grid Custom Topic.

I'll keep working and in a few days I'll update you.

Thank you

0 Votes 0 ·

Hi @AntonioReyes-6388

Yes, your understanding is correct. When the event grid is trying to deliver the validation event to the HTTP endpoint you will be observing the issue as looks like the code that you have written in your function app is not able to parse it correctly.

Yes, you can make the HTTP Trigger function work like the event grid trigger and you can look into this article for reference and the same Github source code was shared in my answer.

If you don't want to use the event grid SDK in the HTTP trigger function then you need to write your own code to parse the json response and it would be more effort for you to write the same code that SDK does for you.

Sure, feel free to get back to me if you need any assistance.

1 Vote 1 ·

where can we see the backend logs

0 Votes 0 ·
SantoshMashettiExternal-4768 avatar image
0 Votes"
SantoshMashettiExternal-4768 answered MayankBargali-MSFT commented

Hi Mayank,

I'm working on Blob Storage POC for an Integration where the source system place a file on blob storage container and trigger an event to Mule API Endpoint hosted in OCP(onprem)

When i try to configure the endpoint , it gives me a deployment error as shown below :, there is no additional information available in the logs to troubleshoot further

Deployment has failed with the following error: {"code":"Url validation","message":"Webhook validation handshake failed for https://abc.com/*. Http POST request failed with response code Unknown. For troublehooting, visit https://aka.ms/esvalidation. Activity id:cb1d3d77-f060-43a3-894f-d8382f40508c, timestamp: 4/28/2021 3:59:40 PM (UTC)."}

There is very limited documentation available on this topic and that too there is no mention or option to configure SSL for webhook endpoint if this is required

I didn't find any console to verify telnet or netcat connection on storage but i was able to telnet "abc.com"443" from azure app services via ssh console and the connection seem to be fine

Where can i view the logs or any console to troubleshoot further

Please provide your inputs

Thanks
Santosh


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

also how to configure certs for an endpoint configured using webhook

0 Votes 0 ·

Hi @SantoshMashettiExternal-4768

Welcome to Microsoft Q&A! Thanks for posting the question.

You should always use tag @username so the person is intimated that someone has tagged them.
As per the error, the validation failed. Please make sure that you have written the validation code so the webhook endpoint is validated correctly.
If you are still facing the issue I will suggest you to create a new Microsoft Q&A post adding azure-event-grid so we can assist you.

0 Votes 0 ·