firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

--inspect-functions breaks when emulating extensions

Open p3nnst8r opened this issue 2 years ago • 6 comments

[REQUIRED] Environment info

firebase-tools: 11.21.0

Platform: Windows 10 Pro (WSL2)

[REQUIRED] Test case

run firebase emulators:exec --inspect-functions --ui 'npm start'

[REQUIRED] Steps to reproduce

  • create a firebase project with functions
  • create a firebase.json with extensions and functions:
{
  "functions": [
    {
      "predeploy": [
        "npm --prefix \"$RESOURCE_DIR\" run build"
      ],
      "source": "functions",
      "codebase": "default",
      "ignore": [
        "node_modules",
        ".git",
        "firebase-debug.log",
        "firebase-debug.*.log"
      ]
    }
  ],
  "emulators": {
    "singleProjectMode": true,
    "functions": {
      "port": 5001
    },
    "storage": {
      "port": 9199
    },
    "ui": {
      "enabled": true
    }
  },
  "storage": {
    "rules": "storage.rules"
  },
  "extensions": {
    "storage-resize-images": "firebase/[email protected]"
  }
}
  • run npm --prefix \"functions\" run build:watch to build the functions
  • run firebase emulators:exec --inspect-functions --ui 'npm start'

[REQUIRED] Expected behavior

  • --inspect-functions should attach to port 9229 on the functions and not the extensions

[REQUIRED] Actual behavior

  • --inspect-functions attaches to port 9229 on the extensions and not the functions

p3nnst8r avatar Jan 23 '23 20:01 p3nnst8r

Hi! Any updates to this?

p3nnst8r avatar Feb 23 '23 22:02 p3nnst8r

I think it's the extensions that are affecting it. If I specify something other than extensions in the only option, the error no longer occurs.

Like this.

firebase emulators:start --only auth,functions,firestore --inspect-functions 

KoheiKanagu avatar Mar 03 '23 07:03 KoheiKanagu

I am having the same issue. As soon as I enable a extension in the firebase.json, e.g.:

  "extensions": {
    "firestore-send-email": "firebase/[email protected]"
  }

the debugger does not attach to my code anymore

glumb avatar May 05 '23 12:05 glumb

Any update on this? BTW im on macOS, so not sure about the windows tag.

"firebase-admin": "11.11.0",
"firebase-functions": "4.5.0",
"firebase-tools": "12.8.1",

Its a real hassle to disable extension when trying to set a breakpoint. Is there any more info needed to be able to fix this?

glumb avatar Nov 14 '23 20:11 glumb

??

DavidWeiss2 avatar Feb 13 '24 16:02 DavidWeiss2

Hey all, sorry for letting this slip by. The extensions emulator works very similarly to the codebases feature of functions, and we've seen issues with codebases & the inspect-functions flag before (ie https://github.com/firebase/firebase-tools/commit/cbd6eb369b90026998f12176f867bc1e47f8ed3d). This may be something similar - I'll investigate further and hopefully find a fix.

joehan avatar Feb 13 '24 18:02 joehan