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

curl gets 500 regardless of grpc error code used in HttpsError

Open ekalosak opened this issue 2 years ago • 3 comments

I'm raising https_fn.HttpsError with various code=https_fn.FunctionsErrorCode.XYZ from within an @https_fn.on_request()-decorated function to test error paths. But if I throw e.g. ostensibly a 400 (FunctionsErrorCode.NOT_FOUND) the caller gets a 500. It doesn't matter what type of error I throw. Is this intentional for on_request? I'd love to have more granular HTTP errors.

Anyway, thanks very much for a lovely Python3 SDK for FB Functions - it's a super convenient service.

ekalosak avatar Aug 26 '23 14:08 ekalosak

For reference, I'm expecting the behavior described in this doc. Maybe I misread it... I'll give it another close reading but I figured it's good to get this reported.

ekalosak avatar Aug 26 '23 14:08 ekalosak

Yeah interestingly enough @https_fn.on_call handles the error codes as I'd expect. It's odd to see the ∆ between on_call and on_request error handling.

ekalosak avatar Aug 26 '23 14:08 ekalosak

Hello @ekalosak. Could you provide a short code sample that I may use to reproduce this issue? Also, do include the contents of your requirements.txt and python version as well.

exaby73 avatar Aug 28 '23 07:08 exaby73