Search code examples
firebasegoogle-cloud-functionsfirebase-cli

How to attach debugger with firebase:shell - firestore clould functions


successfully configured firestore cloud functions in local.

able to run the functions locally using below command.

  1. firebase functions:shell --port=3535

firebase var data = require('./data'); wChangedEvent(data.default);

... ... printing whatever console.log there in wChangedEvent. So this is working properly.

But i need to attach debugger in visual studio code. I tried with below configuration.

   {
        "type": "node",
        "request": "attach",
        "name": "Attach",
        "port": 3535,
        "protocol": "inspector"
    },

But it is not working.


Solution

  • As of late 2020, this pull request added support for the --inspect-functions flag.

    firebase functions:shell --inspect-functions
    

    Unless you explicitly provide another, it will open the default node debugger port 9229.

    With Jetbrains IDEs you can attach to the running process by using an "Attach to Node.js/Chrome" run configuration.