Error Reporting in Azure Functions
Jim
Posted on
Aug 02 2017
We are currently evaluating Azure Functions. Is it possible to use the Raygun error reporting in Azure Functions?
Thanks, Jim
John-Daniel Trask
Raygun
Posted on
Aug 02 2017
Hi Jim,
I'm sure it will be possible. We already have examples of using Raygun with Lamda, and since they operate similarly I'd bet we can get it working. I'll have a chat with the team about getting a blog post / documentation specific to Azure functions though so you can follow along.
Will update this thread once something is up.
Thank you,
John-Daniel Trask
Jim
Posted on
Aug 02 2017
Awesome, thanks!
The challenge I've had with this, is that there are basically three ways that we've found to work with Azure functions. One is by doing everything from the Azure portal. The second is by using the preview version of Visual Studio 2017, with the preview version of the Azure Functions Tools.
For various reasons, we are leaning towards a third approach as described here: https://blog.kloud.com.au/2017/05/03/precompiled-azure-functions-revisited/
In all of these approaches, the function does not actually use a .config file. So, I was not sure how to get Raygun hooked in. If you can shed some light on this, that would be great!
Thanks, Jim
John-Daniel Trask
Raygun
Posted on
Aug 02 2017
Hi Jim,
Thanks for the extra info :-) I haven't tested it out, but there's a strong liklihood you could follow the model used by non-web solutions for Raygun. For example, here's the setup for a console app:
https://raygun.com/docs/languages/net/console-apps
So you could new up a RaygunClient, include the API key directly. The only limitation (and this is similar to Lambda, but I haven't researched it deeply) is that I'm not sure there is a global unhandled exception event to hook onto. Therefore you'll likely want to add a try/catch block at a wide scope, and call the Raygun send event with the exception object from the catch handler.
I'll still have the team take a deeper look and see if there's a better way though Jim :-)
I hope that helps,
John-Daniel Trask
Jim
Posted on
Aug 02 2017
Thanks for your help. By following your blog on AWS Lamda (https://raygun.com/blog/error-reporting-aws-lambda/) I was able to get this working. But as you said, I had to use a try/catch block and send the error to Raygun. That will work fine for now, but if you find a way to catch unhandled exceptions, let me know. :)
Jim