firebase / functions-samples

Collection of sample apps showcasing popular use cases using Cloud Functions for Firebase
https://firebase.google.com/docs/functions
Apache License 2.0
12k stars 3.83k forks source link

https_fn.HttpsError::message isn't really surfaced #1137

Open elbee19 opened 3 weeks ago

elbee19 commented 3 weeks ago

https://github.com/firebase/functions-samples/blob/071ac156f63dbc4fcef5adc492d912c51949978c/Python/quickstarts/callable-functions/functions/main.py#L86

I'm testing a 2nd gen python firebase function defined that looks something like the following:

@https_fn.on_call(
    cors=options.CorsOptions(
        cors_origins=["xxx"],
        cors_methods=["get", "post"],
    )
)
def new_gift(req: https_fn.Request) -> https_fn.Response:
    logger.info("Request Headers:", dict(req.headers))

    if req.authorization is None:
        # Throwing an HttpsError so that the client gets the error details.
        raise https_fn.HttpsError(
            code=https_fn.FunctionsErrorCode.FAILED_PRECONDITION,
            message="This never shows up anywhere!"
        )

During my local testing (over the emulator) the 'message' string isn't really surfaced anywhere - neither to the client when the call to the function is made, nor over the local emulator logs (I'm not sure if the behavior differs over the cloud deployment - yet to test that)

This can't be by design right? Cause what'd be the point of the message string in that case?