Skip to content

Commit ccac0b3

Browse files
committed
handle missing authctxt params
1 parent 564d433 commit ccac0b3

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/firebase_functions/db_fn.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class Event(_core.CloudEvent[T]):
7474
The type of principal that triggered the event.
7575
"""
7676

77-
auth_id: str
77+
auth_id: str | None
7878
"""
7979
The unique identifier for the principal.
8080
"""
@@ -117,9 +117,6 @@ def _db_endpoint_handler(
117117
**instance_pattern.extract_matches(event_instance),
118118
}
119119

120-
event_auth_type = event_attributes["authtype"]
121-
event_auth_id = event_attributes["authid"]
122-
123120
database_event = Event(
124121
firebase_database_host=event_attributes["firebasedatabasehost"],
125122
instance=event_instance,
@@ -136,8 +133,8 @@ def _db_endpoint_handler(
136133
data=database_event_data,
137134
subject=event_attributes["subject"],
138135
params=params,
139-
auth_type=event_auth_type,
140-
auth_id=event_auth_id,
136+
auth_type=event_attributes.get("authtype", "unknown"),
137+
auth_id=event_attributes.get("authid"),
141138
)
142139
_core._with_init(func)(database_event)
143140

0 commit comments

Comments
 (0)