VS Code breakpoints stay grey and the Node.js debugger never stops
Fix it fast
Most common cause, 1 of 4The build writes no source maps
Turn on sourceMap in tsconfig.json (the Firebase TypeScript template ships with it on) and rebuild so every .js gets a .js.map.
{
"compilerOptions": {
"outDir": "lib",
"sourceMap": true
}
}Short answer
VS Code 1.147 shows "Unbound breakpoint" when its debugger cannot map the line you clicked to code that is running. With TypeScript, Firebase Functions in lib/ included, check for missing source maps, an outFiles pattern that misses the compiled files, stale build output, or map paths that point elsewhere. Run Debug: Diagnose Breakpoint Problems first.
Which cause do you have?
Start the debug session, then open the Command Palette and run Debug: Diagnose Breakpoint Problems. The tool reads what the debugger has loaded and names the gap. In a terminal, also list what the build produced next to the JavaScript.
ls lib/*.js lib/*.js.mapThen find the line you see in this list and open its fix:
- 1The build writes no source maps
There is no .js.map file beside the compiled .js and no inline sourceMappingURL comment; the diagnose tool says to set up the build tool to create sourcemaps - 2outFiles in launch.json does not cover the compiled folder
Maps exist, but launch.json narrows outFiles to a folder like dist or out while the code really runs from lib (or the other way round) - 3The running JavaScript is older than your TypeScript
Breakpoints bind on some lines but not on code you just wrote, or the diagnose tool says your compiled code might be out of date with your sources - 4The source map points to paths that differ from your folder
The diagnose tool says it found other files with the same name, or the folder was opened with different letter case than on disk
What does the error look like?
Unbound breakpointWe couldn't find a corresponding source location, and didn't find any source with the name index.ts.We couldn't find a corresponding source location, but found some other files with the same name:Breakpoint ignored because generated code not found (source map problem?)
Cause 1 of 4
The build writes no source maps
You seeThere is no .js.map file beside the compiled .js and no inline sourceMappingURL comment; the diagnose tool says to set up the build tool to create sourcemaps
Check
An Unbound breakpoint in a .ts file often means nothing links that file to the JavaScript Node runs. The VS Code guide says source maps are not always created automatically, so the transpiler has to be told to emit them; TypeScript does it with sourceMap in tsconfig.json.
grep -n '"sourceMap"' tsconfig.jsonFix
Turn on sourceMap in tsconfig.json (the Firebase TypeScript template ships with it on) and rebuild so every .js gets a .js.map.
{
"compilerOptions": {
"outDir": "lib",
"sourceMap": true
}
}Verify
After a rebuild, lib/index.js.map exists and the breakpoint turns solid red once the code loads.
npx tsc && ls lib/index.js.mapConfirmed by code.visualstudio.com
Cause 2 of 4
outFiles in launch.json does not cover the compiled folder
You seeMaps exist, but launch.json narrows outFiles to a folder like dist or out while the code really runs from lib (or the other way round)
Check
Only source maps inside outFiles are resolved by default, and the debugger finds the running .js for your .ts through those globs. The diagnose tool warns when outFiles has been narrowed, since the default already covers the whole workspace except node_modules.
grep -n -A3 '"outFiles"' .vscode/launch.jsonFix
Point outFiles at the JavaScript files (not the .map files) in the folder the program runs from, or delete the entry and keep the default. For Firebase Functions attach to the emulator's inspector port.
{
"name": "Attach to Functions emulator",
"type": "node",
"request": "attach",
"port": 9229,
"outFiles": ["${workspaceFolder}/functions/lib/**/*.js"]
}Verify
Re-attach and trigger the function; execution pauses on the line in src/index.ts.
firebase emulators:start --only functions --inspect-functionsConfirmed by code.visualstudio.com
Cause 3 of 4
The running JavaScript is older than your TypeScript
You seeBreakpoints bind on some lines but not on code you just wrote, or the diagnose tool says your compiled code might be out of date with your sources
Check
The emulator and node run the files in lib, not src. If you edit the .ts without rebuilding, the map still describes the old file, and a breakpoint on a new line has nothing to bind to. The debugger also waits until a file is actually loaded before it binds breakpoints in it.
ls -l src/index.ts lib/index.jsFix
Rebuild before every debug run, or keep the compiler in watch mode in a second terminal while the emulator runs.
npx tsc --watchVerify
lib/index.js has a newer time stamp than src/index.ts and the new line binds.
ls -lt src/index.ts lib/index.jsConfirmed by raw.githubusercontent.com
Cause 4 of 4
The source map points to paths that differ from your folder
You seeThe diagnose tool says it found other files with the same name, or the folder was opened with different letter case than on disk
Check
The debugger joins sourceRoot and sources from each map and looks for the exact path of your .ts. A bundler, a moved project or a different letter case in the opened folder breaks that match even though the map exists.
node -e "const m=JSON.parse(require('fs').readFileSync('lib/index.js.map','utf8')); console.log(m.sourceRoot, m.sources)"Fix
Fix sourceRoot in the build, or map the paths in launch.json with sourceMapPathOverrides (the left side matches the path written in the map, the right side is the file on disk). Reopen the folder using its real casing.
"sourceMapPathOverrides": {
"webpack://@?:*/?:*/*": "${workspaceFolder}/*"
}Verify
Debug: Diagnose Breakpoint Problems no longer lists the breakpoint, and it binds.
code .Confirmed by code.visualstudio.com
How do I stop it coming back?
- Keep sourceMap: true in the shared tsconfig.json and add a CI check that fails when the build output has no .js.map files.
- Commit one attach configuration with an outFiles glob that matches your outDir, so each developer does not invent their own.
- Run the compiler in watch mode alongside the emulator, so the code you debug is always the code you see.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine on the same stack: TaxiDex, Workforce, QistLock.