Repository navigation
Description
I have confirmed that this is a bug related to nvf
- This is a bug, and not an user error or a support request. I understand that my issue will be closed if it is not a bug in nvf.
- I have checked the issues tab and confirmed that my issue has not yet been reported. I understand that my issue will be closed if it is a duplicate.
Description
While configuring vim.debugger.nvim-dap.adapters."pwa-node" in nvf, the generated dap adapter keeps port as a literal string "${port}" instead of a concrete runtime value. This leads to failures when trying to attach Node.js debugging with vscode-js-debug.
Relevant config path:
- modules/plugins/debugger/nvim-dap/nvim-dap.nix
- https://github.com/NotAShelf/nvf/blob/main/modules/plugins/debugger/nvim-dap/nvim-dap.nix
Observed generated Lua adapter snippet:
- type = "server"
- host = "127.0.0.1"
- port = "${port}"
- executable.command = "/nix/store/...-vscode-js-debug-1.117.0/bin/js-debug"
- executable.args = { "${port}" }
Using a custom command like DapNodeAttach with request="attach" and target inspector port 9229 still fails due to adapter connectivity behavior around the unresolved placeholder.
Installation Method
Other
Installation Method (Other)
Configured through custom nvf module options for nvim-dap adapter setup.
nvf Version
main
Reproduction steps
- Configure nvf nvim-dap adapter for pwa-node using server adapter with dynamic placeholder port.
- Set adapter executable to vscode-js-debug and args containing "${port}".
- Rebuild/apply configuration and inspect generated dap adapter Lua.
- Run attach flow for Node.js (target process started with --inspect=127.0.0.1:9229).
- Execute attach command via nvim-dap (e.g., custom DapNodeAttach wrapper).
- Observe connection errors.
Expected behavior
The adapter placeholder behavior should resolve to a real runtime port such that js-debug starts correctly as a DAP server and attach succeeds to the Node inspector endpoint.
Actual Behavior
Observed errors include:
- "DAP Couldn't connect to 127.0.0.1:${port}: ECONNREFUSED"
When trying alternative adapter wiring to connect directly to 9229, attach then fails with:
- "Content-Length not found in headers: HTTP/1.0 400 Bad Request"
which indicates the debugger is speaking DAP to a non-DAP endpoint (Node inspector HTTP/WebSocket).
System Information
❯ nix-info --markdown
- system: `"x86_64-linux"`
- host os: `Linux 6.18.50, NixOS, 26.05 (Yarara), 26.05.20260911.21a67dc`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.34.8`
- nixpkgs: `/nix/store/i2wrp0fbhvysy6bcanmwn6smd3jw938f-source`Relevant log output
Error sample:
DAP Couldn't connect to 127.0.0.1:${port}: ECONNREFUSED
Alternative failure sample:
.../nvim-dap/lua/dap/rpc.lua:30: Content-Length not found in headers: HTTP/1.0 400 Bad Request
Content-Type: text/html; charset=UTF-8Configs
{ pkgs, lib, ... }:
{
programs.nvf = {
enable = true;
settings = {
vim.debugger.nvim-dap = {
enable = true;
ui.enable = true;
# 1. Register the js-debug adapter once
# adapters.pwa-node = {
# type = "server";
# host = "127.0.0.1";
# port = "\${port}";
# executable = {
# command = "${pkgs.vscode-js-debug}/bin/js-debug";
# args = [ "\${port}" ];
# };
# };
adapters."pwa-node" = lib.generators.mkLuaInline ''
function(callback, config)
callback({
type = "server",
host = "127.0.0.1",
port = "''${port}",
executable = {
command = "${pkgs.vscode-js-debug}/bin/js-debug",
args = { "''${port}" },
},
})
end
'';
# # 2. Attach configuration for JS/TS file types
# configurations = lib.genAttrs [
# "javascript"
# "typescript"
# "javascriptreact"
# "typescriptreact"
# ] (_: nodeConfigurations);
};
vim.extraPackages = with pkgs; [
vscode-js-debug
nodejs
];
vim.luaConfigRC.dap-attach = ''
local dap = require("dap")
vim.api.nvim_create_user_command("DapNodeAttach", function()
dap.run({
type = "pwa-node",
request = "attach",
name = "Attach to Node.js",
address = "127.0.0.1",
port = 9229,
protocol = "inspector",
sourceMaps = true,
cwd = "''${workspaceFolder}",
})
end, {})
'';
};
};
}
Activity
horriblename commentedon Oct 20, 2026
As a first step, please check
:checkhealth dapAlso let me know if specifying a concrete port number e.g.
{port = 9000; executable.args = ["9000"];}worksAttach your (ideally minimal) config as well
victor-shelepen commentedon Oct 20, 2026
I've attached my config to the description.
I start the application the following way and then I attach to it using the custom function.
victor-shelepen commentedon Oct 20, 2026
I also tried a function approach for the latest bindings.
victor-shelepen commentedon Oct 20, 2026
I checked the option.
https://github.com/NotAShelf/nvf/blob/main/modules/plugins/debugger/nvim-dap/nvim-dap.nix
victor-shelepen commentedon Oct 20, 2026
snoweuph commentedon Oct 21, 2026
to read the config, you will need to use a lua callback and read the config. see debugpy for example.
https://github.com/NotAShelf/nvf/blob/main/modules/plugins/debugger/nvim-dap/presets/debugpy.nix#L27
horriblename commentedon Oct 21, 2026
This worked for me. Note the second arg '127.0.0.1' for the executable. Turns out their default hostname is
::1so no ipv4. Presumably you can use the ipv6 address instead and drop the second argvictor-shelepen commentedon Oct 21, 2026
Hello. I've reached some results. But it is not ideal. Here is my current config. Currently, I prefer the attach mode. It uses a callback approach; it uses static variables; it passes an IP address to sure that IPv4 is used. I am new to this topic. I would be pleased to receive some comments to enhance my config.
victor-shelepen commentedon Oct 21, 2026
My variant does not close the js-debug server, so I can not start again.