New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot attach a debugger to Firebase Python Functions #6838
Comments
Hey @johnnyoshika, thanks for reaching out. Currently, For those who also find this feature valuable, please leave a thumbs up on the original post. This helps our engineers prioritize future development efforts. |
As a workaround, I tried to debug my python functions starting the emulators and then executing the starting the function manually. However for this to work I need to provide credentials, and then the function targets the production services instead of the emulator. |
Have you tried setting these env variables?
|
Thanks @johnnyoshika. That solution worked As a workaround to debug a Firebase Cloud function in Python, with breakpoint and all, I added this code to my main.py
where:
First I start the all the emulators:
And then I run the main.py in debug mode directly from VSCode |
@pamafe1976 Thank you! I'll give that a try the next time I need to debug these functions. |
@pamafe1976 so the main.py is like a custom one that you have to test these functions, or it is the typical where you declare all the endpoints (@https_fn.on_request ...)? |
Its actually the same main.py At the beginning I have a global variable
and the body of the main is something like this:
So when I set RUN_LOCAL=True, I can debug locally the function that is called (in this case requestLocations) |
@aalej to be honest is pretty annoying. I don't understand why there are so few resources related to Python environments compared to JS when both platforms are supposed to be supported in Firebase Functions. Something fails silently and you spend hours adding traces everywhere when debugging you would find it in a matter of minutes. Are we just 5 people using Python here? |
I guess it may because Python support started with 2nd gen |
@pamafe1976 I forgot, thank you very much for the tip. But it's really helpful though and I will use it for sure. |
[REQUIRED] Environment info
firebase-tools: 12.9.1
Platform: Windows / macOS
[REQUIRED] Test case
Run emulator with
--inspect-functions
flag:[REQUIRED] Steps to reproduce
Run emulator with
--inspect-functions
flag:This message appears in the console:
[REQUIRED] Expected behavior
Debugger would attach to Python functions
[REQUIRED] Actual behavior
Receive a message in the Console that debugger is not supported
The text was updated successfully, but these errors were encountered: