Skip to content Skip to sidebar Skip to footer

Firebase Serve And Debugging Functions?

I ran firebase serve --only-functions Then ran functions inspect addMessage So I could debug the addMessage function. Debugging however did not work. Running firebase deploy

Solution 1:

try: ndb firebase serve

debugger breakpoints are hit with stack traces visible, note it's a little slow so give the debugger time to instrument the child processes

Additionally I was able to debug cloud functions in isolation using (caps for removed values):

GCLOUD_PROJECT=THE-FIREBASE-PROJECT node --inspect-brk /path/to/functions-framework --target FUNCTION-NAME --port=5000

where functions-framework simply expands to the full path for the installed functions-framework (global in my case) from the working directory where the index.js file is for the target functions.

Alternately when or where the FIREBASE_CONFIG is needed try this format adjusted to fit: FIREBASE_CONFIG="{\"databaseURL\":\"https://YOUR-FIREBASE-PROJECT.firebaseio.com\",\"storageBucket\":\"YOUR-FIREBASE-PROJECT.appspot.com\",\"projectId\":\"YOUR-FIREBASE-PROJECT\"}

Solution 2:

As of firebase-tools v7.11.0, the Firebase emulator now supports attaching a debugger with the --inspect-functions option. This answer shows WebStorm-specific instructions that can be easily adapted to other debuggers.

Post a Comment for "Firebase Serve And Debugging Functions?"