Skip to content

Debugger disconnects a few seconds after it hits a breakpoint #5991

@mashoba7

Description

@mashoba7

Environment info

firebase-tools: 12.3.1
VS Code: (Code > About Visual Studio Code)

  • Version: 1.79.0
  • Node.js: 16.17.1
  • V8: 10.8.168.25-electron.0

Platform: macOS Ventura (13.3.1)

Test case

exports.callMe = onCall(
    {
        region: "europe-west2",
    },
    async (request) => {
        const response = "1";
        return response;
    }
);

Steps to reproduce

Put a breakpoint and run the app with npm run build && firebase emulators:start --inspect-functions command and then hit the function with the url given on console.

Expected behavior

To have the debugger active for as long as I don't let it go.

Actual behavior

Debugger consistently disconnects a few seconds after it hits a breakpoint.

Logs obtained with --debug:

Your function timed out after ~undefineds. To configure this timeout, see
      https://firebase.google.com/docs/functions/manage-functions#set_timeout_and_memory_allocation. {"metadata":{"emulator":{"name":"functions"},"message":"Your function timed out after ~undefineds. To configure this timeout, see\n      https://firebase.google.com/docs/functions/manage-functions#set_timeout_and_memory_allocation."}}
i  Request to function failed: Error: socket hang up {"metadata":{"emulator":{"name":"functions"},"message":"Request to function failed: Error: socket hang up"}}
[2023-06-15T19:19:58.816Z] [work-queue] {"queuedWork":[],"queueLength":0,"runningWork":[],"workRunningCount":0}
[2023-06-15T19:19:58.824Z] [worker-~free~-03f1fc7b-b8f6-426a-99a9-ddd084ab4f61]: exited {"metadata":{"emulator":{"name":"functions"},"message":"[worker-~free~-03f1fc7b-b8f6-426a-99a9-ddd084ab4f61]: exited"}}
[2023-06-15T19:19:58.824Z] [worker-~free~-03f1fc7b-b8f6-426a-99a9-ddd084ab4f61]: FINISHED {"metadata":{"emulator":{"name":"functions"},"message":"[worker-~free~-03f1fc7b-b8f6-426a-99a9-ddd084ab4f61]: FINISHED"}}

The link https://firebase.google.com/docs/functions/manage-functions#set_timeout_and_memory_allocation is not helpful. I don't think it is even related but I tried with timeoutSeconds: 540 configuration nonetheless which did not help.

launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "attach",
            "name": "Debug",
            "port": 9229
        }
    ]
}

tsconfig.json:

{
  "compilerOptions": {
    "module": "commonjs",
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "outDir": "lib",
    "sourceMap": true,
    "strict": true,
    "target": "es2017"
  },
  "compileOnSave": true,
  "include": [
    "src"
  ]
}

package.json:

{
  "name": "functions",
  "scripts": {
    "lint": "eslint --ext .js,.ts .",
    "build": "tsc",
    "build:watch": "tsc --watch",
    "serve": "npm run build && firebase emulators:start --only functions",
    "shell": "npm run build && firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "20"
  },
  "main": "lib/index.js",
  "dependencies": {
    "axios": "^1.4.0",
    "firebase-admin": "^11.8.0",
    "firebase-functions": "^4.4.1",
    "firebase-tools": "^12.3.1",
    "moment": "^2.29.4"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^5.12.0",
    "@typescript-eslint/parser": "^5.12.0",
    "eslint": "^8.9.0",
    "eslint-config-google": "^0.14.0",
    "eslint-plugin-import": "^2.25.4",
    "firebase-functions-test": "^3.1.0",
    "typescript": "^4.9.0"
  },
  "private": true
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions