Azure / azure-functions-eventgrid-extension

EventGrid extension for Azure Functions
MIT License
48 stars 32 forks source link

Event Grid trigger always returns HTTP 202 #35

Open paulbatum opened 6 years ago

paulbatum commented 6 years ago

From @glaserbeamer on April 20, 2018 2:38

Summary: When an Event Grid trigger function throws an exception, I would expect an HTTP 500 to be returned to Event Grid; instead, this returns an HTTP 202, so Event Grid believes that processing was successful, and it never replays the event.

Repro steps:

  1. Add new "Event Grid trigger" function (C#).
  2. Change body of function to "throw new Exception();"
  3. Save and run.

Sample log output (using default/sample event): 2018-04-20T02:21:43.875 [Info] Function started (Id=) 2018-04-20T02:21:44.125 [Error] Exception while executing function: Functions.EventGridTriggerCSharp1. mscorlib: Exception has been thrown by the target of an invocation. f-EventGridTriggerCSharp1__1818170464: Exception of type 'System.Exception' was thrown. 2018-04-20T02:21:44.187 [Error] Function completed (Failure, Id=, Duration=313ms)

HTTP return code: 202 Accepted

Copied from original issue: Azure/azure-functions-templates#673

paulbatum commented 6 years ago

@glaserbeamer Is this on functions V1 or V2?

@watashiSHUN I'm surprised about this reported behavior, considering that we are not doing any internal queuing yet.. any ideas whats up?

watashiSHUN commented 6 years ago

same issue mentioned here: https://github.com/Azure/azure-functions-eventgrid-extension/issues/32

glaserbeamer commented 6 years ago

@paulbatum Thanks for moving the issue here. I believe this is a V1 function.

@watashiSHUN Thanks for the reference and your detailed response there. I can use an HTTP trigger until this changes.

When creating the Event Grid trigger, it directs users here for logging issues: https://github.com/Azure/azure-functions-templates/issues. It may help to link here instead, if possible.

DiaAWAY commented 6 years ago

I see that a fix has already been committed, when can we expect this change to be available?

watashiSHUN commented 6 years ago

since we are not doing any deployment during build conference, I would say in a month

jeffhollan commented 6 years ago

Just realized this was an issue when I saw latest release. The catch here though is I don't think Event Grid will keep the HTTP connection open for very long - so if my execution lasted 45 seconds I think it would time out and retry? I can check with Event Grid team on how long it will keep an event connection open -- but I suppose the fact that they have the status code drive deadlettering means we are likely doing what event grid expects.

jeffhollan commented 6 years ago

Just kidding - I may be wrong here - looks like we did wait for function to execute before as well? but we'd always return a 202 anyway? Let me know as I think I assumed incorrectly

msimpsonnz commented 5 years ago

I had the same issue with async Tasks and it was down to just not handling the exception, we were calling an external service but silently handling the error

mishas23 commented 5 years ago

since we are not doing any deployment during build conference, I would say in a month

I see that this got fixed in V2.0 but not in V1.0. For some reason our service cannot upgrade to .NET core and hence I am stuck with V1.0. Can you please consider the fix in V1.0 as well. Thanks!