1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414"""Cloud functions to handle Eventarc events."""
15-
1615# pylint: disable=protected-access
1716import typing as _typing
1817import datetime as _dt
1918import time as _time
2019import json as _json
20+
21+ from firebase_functions .core import _with_init
2122from firebase_functions .https_fn import HttpsError , FunctionsErrorCode
2223
2324import firebase_functions .private .util as _util
@@ -351,8 +352,8 @@ def before_operation_handler(
351352 jwt_token = request .json ["data" ]["jwt" ]
352353 decoded_token = _token_verifier .verify_auth_blocking_token (jwt_token )
353354 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 )
356357 if not auth_response :
357358 return _jsonify ({})
358359 auth_response_dict = _validate_auth_response (event_type , auth_response )
@@ -362,7 +363,7 @@ def before_operation_handler(
362363 # pylint: disable=broad-except
363364 except Exception as exception :
364365 if not isinstance (exception , HttpsError ):
365- _logging .error ("Unhandled error" , exception )
366+ _logging .error ("Unhandled error %s " , exception )
366367 exception = HttpsError (FunctionsErrorCode .INTERNAL , "INTERNAL" )
367368 status = exception ._http_error_code .status
368369 return _make_response (_jsonify (error = exception ._as_dict ()), status )
0 commit comments