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

Added handler for Azure Function runtime #832

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ahuggins-nhs
Copy link

Azure functions operate similarly to AWS Lambda in that uncaughtException events are not emitted.
Support for these patterns are added as convenience methods to pass-through the expected results from both sync and async patterns.
https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-error-pages#use-structured-error-handling
https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node

Azure functions operate similarly to AWS Lambda in that uncaughtException events are not emitted.
Support for these patterns are added as convenience methods to pass-through the expected results from both sync and async patterns.
https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-error-pages#use-structured-error-handling
https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node
@ahuggins-nhs
Copy link
Author

This was directly inspired and riffed from https://docs.rollbar.com/docs/aws-lambda. For Azure, this wasn't very complex as they depend on the first-class async function to pass a result back to the runtime or to return void. For sync functions, the developer calls context.done() to finalize the sync method. In either case, we're just passing plain object/void back.

Testing revealed that errors were not surfacing correctly. Promise pattern similar to lambda handler resolves issue.
@ahuggins-nhs
Copy link
Author

ahuggins-nhs commented Apr 10, 2020

@waltjones, do you have any thoughts on this? We're looking at rolling out Rollbar more widely across our Azure applications. Currently we're modifying the prototype to add this code in one or two Azure Function App projects, but it would be nice to have this included in the upstream.

@waltjones
Copy link
Contributor

@ahuggins-nhs Apologies for the delay. The next release will be when I'm able to loop back to rollbar.js.

Superficially, the PR looks good. Tests would be good. (I realize there are not tests for the LambdaHandler, and that needs to be improved.)

@ahuggins-nhs
Copy link
Author

Superficially, the PR looks good. Tests would be good. (I realize there are not tests for the LambdaHandler, and that needs to be improved.)

I'll give some thought on writing tests. Our workload has picked up considerably, but I might be able to carve some time to write them in the next week. Thanks, @waltjones !

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

Successfully merging this pull request may close these issues.

2 participants