Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging functions with VSCode #6945

Open
albertosantini opened this issue Dec 5, 2024 · 0 comments
Open

Debugging functions with VSCode #6945

albertosantini opened this issue Dec 5, 2024 · 0 comments
Labels
type: bug code to address defects in shipped code

Comments

@albertosantini
Copy link

albertosantini commented Dec 5, 2024

Describe the bug

Windows 11 / Powershell 7.4.6 / VSCode 1.95.3 / Netlify CLI 17.38.0

The breakpoint is not triggered.

Generally speaking, a few versions ago, Netlify CLI worked without any problem, but I think it was more than one year ago last time I debugged a function.

I read the manual (RTFM), I read a few old issues, I read a few posts in the forum, I tried different setups, but the result didn't change: the breakpoint is not triggered.

Weird workaround
Set the breakpoint to the generated or bundled function
.netlify/functions-serve/hello/netlify/hello.mjs
instead of
netlify/functions/hello.js

With the workaround eventually the debugger stops to the breakpoint.

Any hint?

Steps to reproduce

  1. VSCode / load a Netlify project
  2. VSCode / open JavaScript Debug Terminal
  3. Terminal / start Netlify CLI ntl dev (Netlify CLI installed globally)
  4. Terminal / Debugger attached. displayed
  5. Netlify / project started
  6. Netlify / open browser to localhost:8888
  7. VSCode / add a breakpoint to the function hello netlify/functions/hello.js
  8. Browser / navigate to hello function http://localhost:8888/.netlify/functions/hello

Configuration

netlify.toml: none

hello.js

export default async () => {
    return new Response("Hello World");
};

Environment

 System:
    OS: Windows 11 10.0.26100
    CPU: (8) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
    Memory: 7.48 GB / 15.84 GB
  Binaries:
    Node: 22.12.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.9.1 - C:\Program Files\nodejs\npm.CMD
@albertosantini albertosantini added the type: bug code to address defects in shipped code label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

1 participant