Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error handling for input/output bindings #1528

Open
mathewc opened this issue May 22, 2017 · 4 comments
Open

Error handling for input/output bindings #1528

mathewc opened this issue May 22, 2017 · 4 comments
Labels
Milestone

Comments

@mathewc
Copy link
Member

mathewc commented May 22, 2017

We need a way for people to write error handling code for their input/output bindings, for errors that happen outside of their function logic (e.g. when binding fails in our fx code, not user code). Traditionally, our answer to this has been to rely on the inherent trigger restart logic (varies per trigger). E.g. for a queue trigger, if any of the in/out bindings fail, the queue message will be retried after some time.

However, in some cases, users want to be able to write error handling code for their bindings. They can usually do this by binding to an IAsyncCollector/ICollector and wrapping a try/catch around the calls to Add/Flush. However the model isn't consistent across all bindings. Note: we also want a solution that can apply for languages other than C# in Azure Functions scenarios.

Likely related to the Filters feature we've discussed: Azure/azure-webjobs-sdk#980. The reason being, that in order to be able to capture errors in input bindings as well, the error handling needs to be set up before the function is invoked. Initially for handling output binding scenarios, I had considered an model where the user could subscribe an event handler imperatively in their code, e.g. executionContext.OnError += .... Again - we'll need a design that works for Azure Functions non C# languages as well.

@mathewc mathewc changed the title Error handling for output bindings Error handling for input/output bindings May 22, 2017
@paulbatum paulbatum added this to the Next - Triaged milestone May 30, 2017
@mathewc
Copy link
Member Author

mathewc commented Aug 16, 2017

The Invocation Filters feature in core SDK is now checked in, so for C# functions you can add an exception filter to address this issue.

Filter support for other languages is still pending - see #1761.

@deshmanedarshan
Copy link

deshmanedarshan commented Apr 26, 2019

@deshmanedarshan
Copy link

Hi @mathewc, Can you please let me know whether AZURE infrastructure does a retry when there is SendGrid binding failure ?

@mathewc
Copy link
Member Author

mathewc commented Apr 29, 2019

The SendGrid output binding doesn't do retries itself (code https://github.com/Azure/azure-webjobs-sdk-extensions/blob/7fcca7f5ce44c28b1bc9cff51592737c95c78c5f/src/WebJobs.Extensions.SendGrid/Bindings/SendGridMessageAsyncCollector.cs#L56). It just uses the SendGrid SDK to send. If the invocation fails, retries for the trigger that caused the invocation will happen, based on what trigger type is used. E.g. if its a queue message, the queue message will be retried after some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants