firebase-functions-python icon indicating copy to clipboard operation
firebase-functions-python copied to clipboard

fix: preserve crashlytics options

Open IzaakGough opened this issue 6 months ago • 0 comments

Fixes #265

Summary

Alert-based function decorators were reconstructing FirebaseAlertOptions with only alert_type and app_id, which dropped shared handler settings like region, max_instances, retry, and secrets. This change preserves the full option set when building alert endpoints and adds coverage across the alert wrappers that delegate to FirebaseAlertOptions.

Problem/Root Cause

Issue #265 reports that Crashlytics alert handlers ignored configuration such as region, max instances, and secrets. The same pattern also applied to the other alert-specific option wrappers. In each _endpoint() implementation, the wrapper created a fresh FirebaseAlertOptions with just the alert identifiers, so the inherited EventHandlerOptions fields on the original options object never made it into the generated endpoint manifest.

Solution/Changes

Add a shared helper that copies the dataclass fields from the original alert options object into a new FirebaseAlertOptions, while overriding only alert_type and app_id where needed. Update the App Distribution, Crashlytics, Performance, and Billing option wrappers to use that helper before generating the endpoint. Expand tests/test_options.py with endpoint assertions that verify shared options are preserved for each alert wrapper and for direct alerts_fn.on_alert_published(...) usage.

Testing

  • uv run pytest tests/test_options.py

IzaakGough avatar Jun 02 '26 11:06 IzaakGough