12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
"""Cloud functions to handle Eventarc events."""
15
-
16
15
# pylint: disable=protected-access
17
16
import typing as _typing
18
17
import datetime as _dt
19
18
import time as _time
20
19
import json as _json
20
+
21
+ from firebase_functions .core import _with_init
21
22
from firebase_functions .https_fn import HttpsError , FunctionsErrorCode
22
23
23
24
import firebase_functions .private .util as _util
@@ -351,8 +352,8 @@ def before_operation_handler(
351
352
jwt_token = request .json ["data" ]["jwt" ]
352
353
decoded_token = _token_verifier .verify_auth_blocking_token (jwt_token )
353
354
event = _auth_blocking_event_from_token_data (decoded_token )
354
- auth_response : BeforeCreateResponse | BeforeSignInResponse | None = func (
355
- event )
355
+ auth_response : BeforeCreateResponse | BeforeSignInResponse | None = _with_init (
356
+ func )( event )
356
357
if not auth_response :
357
358
return _jsonify ({})
358
359
auth_response_dict = _validate_auth_response (event_type , auth_response )
@@ -362,7 +363,7 @@ def before_operation_handler(
362
363
# pylint: disable=broad-except
363
364
except Exception as exception :
364
365
if not isinstance (exception , HttpsError ):
365
- _logging .error ("Unhandled error" , exception )
366
+ _logging .error ("Unhandled error %s " , exception )
366
367
exception = HttpsError (FunctionsErrorCode .INTERNAL , "INTERNAL" )
367
368
status = exception ._http_error_code .status
368
369
return _make_response (_jsonify (error = exception ._as_dict ()), status )
0 commit comments