question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[EASY!] firebase emulator:start (in debug mode)

See original GitHub issue

image

Before we could debug firebase functions in a local machine by running emulator and attaching a debugger using (@google-cloud/functions-emulator) more info at https://cloud.google.com/functions/docs/emulator

For example Debugging with the Node.js Emulator. You can debug your functions running in the Node.js Emulator using either the standard Node.js Debugger or the V8 Inspector integration. To debug using the standard Node.js Debugger, run the following command:

functions debug helloWorld

since The Cloud Functions Emulator has been deprecated

Now I use firebase emulators:start --only functions (more info https://firebase.google.com/docs/functions/local-emulator)

I can run my functions locally but can not attach debugger like I used to do. And seems there are no docs on how to attach debugger for functions served by command “firebase emulators:start”

My question how we can attach a debugger to set breakpoints like here https://github.com/googlearchive/cloud-functions-emulator/wiki/Debugging-with-Visual-Studio-Code For example firebase --debug emulators:start --only functions
and in my vscode attach to port/process and set breakpoints

Please submit feature requests through our support page.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:13
  • Comments:30 (10 by maintainers)

github_iconTop GitHub Comments

28reactions
sultanmyrzacommented, May 31, 2020

Solved: on how to debug firebase functions in emulator (without any dependencies like @google-cloud/functions-emulator)

✅ no need for external libs (@google-cloud/functions-emulator) pure firebase functions ✅. hot reload no code change

  1. init firebase project firebase init
  2. add npm script in package.json "debug": "tsc -w | firebase emulators:start --inspect-functions",
  3. run npm run debug
  4. press F1 in vscode select Debug: Attach to Node Process
  5. it will prompt running processes select process usually its first one

here are screenshot steps https://imgur.com/a/LUSW8NF

4reactions
vongohrencommented, Sep 21, 2019

@samtstern question, the known issue you are pointing to is not very releated. This issue demands some documentation on how to acctually do the debugging, because now since firebase emulators is the go to runner of a functions setup with emulators, there should be some way to run an attached process to the running node code.

The attached issue points to some issue after it seems he has gotten it to work.

But why is it not a clear way to just open a debugger inspect port?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Debugging Firebase Functions in VS Code - Medium
Debugging Configuration. Click on the run/debug icon in VS Code on the left side. Then click the gear to edit the launch.json file....
Read more >
Run functions locally | Cloud Functions for Firebase - Google
To run the Cloud Functions emulator, use the emulators:start command: ... For example a simple helloWorld function with the default host port and...
Read more >
Debugging functions in firebase emulator without deploying first
The emulator is properly setup, I can test and debug cloud functions, BUT I have to deploy them first. Am I missing something?...
Read more >
firebase emulators:start - Fig.io
--inspect-functions <arg>, Emulate Cloud Functions in debug mode with the node inspector on the given port (9229 if not specified).
Read more >
Firebase emulators now support step-through debugging
I can't find any documentation, but the release notes say that you just put --inspect-functions on the command line. Anyone given it a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found