Skip to content

Debugging functions with VSCode #6945

Open
@albertosantini

Description

@albertosantini

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @albertosantini@serhalp

        Issue actions

          Debugging functions with VSCode · Issue #6945 · netlify/cli