Using vercel dev with chrome debugger

I have created a basic hello world project here

When I run NODE_OPTIONS='--inspect' vercel dev, I see this

Debugger listening on ws://127.0.0.1:9229/c3ca97bb-dd9a-4ef5-bee4-6d94ce06d9aa
For help, see: https://nodejs.org/en/docs/inspector
Vercel CLI 39.2.5
> Ready! Available at http://localhost:3000

However, when I launch my chrome debugger nothing is happening. None of my console.log statements are in the chrome inspector console and none of my debugger statements halt code execution.

What is the current best practice to use the chrome debugger with vercel cli locally?

Edit:

This repo is setup with a serverless function that just returns {"message":"Hello World!"}

When I hit http://localhost:3000/api/hello I would expect to see my console.logs and debugger breakpoints in my chrome debugger which I open by clicking this

However, I get the following output in my CLI

🐚 NODE_OPTIONS='--inspect' vercel dev

Debugger listening on ws://127.0.0.1:9229/35b6777e-d127-49fe-a43b-da3872639b3d
For help, see: https://nodejs.org/en/docs/inspector
Vercel CLI 39.2.5
> Ready! Available at http://localhost:3000
Starting inspector on 127.0.0.1:9229 failed: address already in use
This is a log message from the serverless function
Starting inspector on 127.0.0.1:9229 failed: address already in use

Does it work if you switch to a different port? There’s an example of how to do that in this guide: Access local servers and Chrome instances with port forwarding

This did not fix the issue. I did modify my command to use NODE_OPTIONS="--inspect-brk" and the chrome debugger will halt execution here.

However, this looks like internal vercel code. I cannot get the debugger; statement I put in my hello.ts file to work as a breakpoint. It seems like node wants to do something but I continue to get this message in my console

Starting inspector on 127.0.0.1:9229 failed: address already in use

Just soft-bumping this issues to get some community comments.

What is the debugging experience for other devs that use the vercel cli? Are other people using Chrome’s built-in debugger or something in VS Code or another technique?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.