-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Version info
"firebase-tools": "3.13.1"
"firebase-functions": "0.7.1"
I'm looking to locally debug my emulated functions (in vscode for now) using the new experimental:functions:shell.
In firebase/firebase-functions#4 @laurenzlong mentions it should be capable with firebase shell, if it's possible in google cloud functions emulator.
(I'm going with a github issue over an SO post or support ticket, as this may lead to a nice PR if the firebase team aren't already working on this feature.)
I've yet to get anything to attach, and i'm not too familiar with attaching to debug processes. Here's what I've tried, working backwards from the google cloud functions instructions:
Launch command for firebase emulator:
firebase experimental:functions:shell --port 5000
//forcing port 5000 to simplify the launch task, we could possibly look into connecting to the process directly if this is smelly
My launch.json in vscode:
{
"type": "node",
"request": "attach",
"name": "Debug Firebase Function Emulator",
"port": 5000,
"protocol": "legacy" //As we're using node 6, this seems essential
}
In the firebase tools emulator script, it looks like we're only calling start() for each function. Whereas, according to the debugging google cloud functions guide, we need to be calling
debug() in order to allow attaching the debugger.
I'm assuming the firebase functions emulator will have some options in the future, something like --debug. If anyone has any tips/pointers that might help me investigate, please let me know 👌
I'm going to attempt:
-
Modifying the script to attach to my node debugger.
-
Adding
--debugflag if I can get that to work, and possibly PR if firebase is happy