This feature was first introduced in Release 14, but due to a bug, we rolled it back. Now reintroduced in Release 15, we’re giving it the attention it deserves. Poly offers a native event stream for any errors (400-500 series response codes or explicitly thrown errors) and provides an error handlers submodule to capture them in native code. With this feature, server functions can now subscribe directly to the error event stream on the Poly platform. While this feature is available via API, UI support is coming soon.
Why Triggering Server Functions From Error Events Matters
When an error event is raised, it details the impacted function, client or user, and error context. Developers gain full native development flexibility to respond. This capability enhances developer experience and control for several critical use cases:
- Alerting: Notify client owners, support teams, and service owners with error details. Alerts can be integrated with systems like PagerDuty or DataDog.
- Incident Management: Automatically classify and raise incidents with the correct teams through systems like ServiceNow.
- Automated Diagnostics: Trigger logic to collect just-in-time diagnostic data for easier troubleshooting. Automated test suites can assess the scope of problems encountered.
- Self-Healing: Programmatically attempt remediation steps, such as clearing a cache or restarting a service.
- Dynamic Scaling: While Poly auto-scales as a Kubernetes-native platform, error events can trigger scaling of underlying services or adjust rate limits to prevent overload.
- Rollbacks: Based on error patterns and release timing, orchestration logic can trigger automatic rollbacks.
What Makes This Feature Stand Out?
- Flexible Subscription Scope: Subscriptions use context paths and function names, allowing dynamic subscriptions to sets of functions or individual ones as new functions are added.
- Flexible Execution Logic: Orchestration logic can be written in TypeScript, Python, Java, and soon, C#. You can implement validation, filtering, routing, or any desired logic.
- Native System Events: Errors are raised even without an active subscription, with information about the impacted function, client, and error context. All server function errors are available for handling.
- Ease of Use: The API is straightforward to configure, and with UI support coming soon, implementation will be even faster and simpler.
Watch a demo of using the error handler locally here.
Implementing PolyAPI’s Vision
PolyAPI aims to empower enterprises to operate integrations and services at scale. This means enabling easy implementation of reusable flows across services, making what was once economically prohibitive now simple and achievable. We aim to improve service quality for integrations, orchestrations, and microservices by equipping operations teams with sophisticated automation.
Interested in learning more? Reach out at hello@polyapi.io.