When I moved to python 3.11 with my Google functions, logs started to be splitted in multiple lines. For example if function result in error, Traceback is splitted in many lines which makes it really hard to debug. Example in the screenshot below.
Previously I deployed functions in python 3.7 and Traceback errors where all in one log entry
How to prevent that?
It's because of Fine-grained error locations in tracebacks, which is actually a really cool feature of python 3.11. I'm assuming GCP's logging just doesn't handle this at the moment.
As a quick fix, you can disable this by setting this environment variable: PYTHONNODEBUGRANGES=0
, which should make the error messages look normal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With