---
title: "Comment by Michal on \"How to debug Netlify serverless lambda functions using VS Code for your JAMstack app\" | Hashnode"
description: "Hi, thanks for a great article. I tried to follow it but can&#39;t make it work. After some investigation it looks like the sourcemaps for lambda functions are"
url: "https://hashnode.com/posts/how-to-debug-netlify-serverless-lambda-functions-using-vs-code-for-your-jamstack-app/5fb0becac03b0e471014fd25/comment/5fcb4d022e4db7780e483068"
---

[Discussion](https://hashnode.com/posts/how-to-debug-netlify-serverless-lambda-functions-using-vs-code-for-your-jamstack-app/5fb0becac03b0e471014fd25)

Comment [How to debug Netlify serverless lambda functions using VS Code for your JAMstack app](https://hashnode.com/posts/how-to-debug-netlify-serverless-lambda-functions-using-vs-code-for-your-jamstack-app/5fb0becac03b0e471014fd25)

[Michal](https://hashnode.com/@michalhudecek)

[Dec 5, 2020](https://hashnode.com/posts/how-to-debug-netlify-serverless-lambda-functions-using-vs-code-for-your-jamstack-app/5fb0becac03b0e471014fd25/comment/5fcb4d022e4db7780e483068)

Hi,

thanks for a great article. I tried to follow it but can't make it work. After some investigation it looks like the sourcemaps for lambda functions are actually not generated at all and therefore the breakpoints do not work. I can't find sourcemaps in `/lambda` folder. Am I missing any pre-requisite?

I am using `netlify-cli/2.69.1 win32-x64 node-v14.15.1`

Thanks

[Tapas Adhikary](https://hashnode.com/@atapas)

[Dec 7, 2020](https://hashnode.com/posts/how-to-debug-netlify-serverless-lambda-functions-using-vs-code-for-your-jamstack-app/5fb0becac03b0e471014fd25/comment/5fcb4d022e4db7780e483068#reply-5fcdc285f4006d0b1bee0241)

I am running with the same version of the netlify-cli and found it working. Actually, I got the same error in the beginning when I had issues in establishing the debugging(one of the motivations for writing this article).

A couple of things that I could found to resolve is,

-   If you have installed netlify locally, have this property set correctly

```
"program": "${workspaceFolder}\\node_modules\\.bin\\netlify"
```

If you have `netlify` globally, please omit the program property altogether.

-   If you are using pwa-node, make sure you have `resolveSourceMapLocations` defined.

Here is an example of the `launch.json` file where netlify is defined globally with pwa-node,

```
{
    "version": "1.0.0",
    "configurations": [
      {
        "name": "Netlify Debugging",
        "type": "pwa-node",
        "request": "launch",
        "runtimeArgs": ["run-script", "debug"],
        "runtimeExecutable": "npm",
        "skipFiles": ["<node_internals>/**"],
        "resolveSourceMapLocations": [
            "${workspaceFolder}/**",
            "!**/node_modules/**"
        ]
      }
    ]
  }
```

Please let me know if it helps. If you happen the fix it in any other ways, that would be great too to be aware [Michal](https://hashnode.com/@michalhudecek).

Another thing is, make sure the same port netlify is _not_ running in parallel too..

With all the explained here, I am able to run it.. Just done the same settings again as it explained..

[Michal](https://hashnode.com/@michalhudecek)

[Dec 7, 2020](https://hashnode.com/posts/how-to-debug-netlify-serverless-lambda-functions-using-vs-code-for-your-jamstack-app/5fb0becac03b0e471014fd25/comment/5fcb4d022e4db7780e483068#reply-5fcdcc2e7d1d8b0b087482ca)

[Tapas Adhikary](https://hashnode.com/@atapas) Hi, neither of these things help. It looks like the sourcemap files for lambda functions are not generated at all. Where exactly do you have them? In `/lambda` folder with generated .js files?

[Tapas Adhikary](https://hashnode.com/@atapas)

[Dec 7, 2020](https://hashnode.com/posts/how-to-debug-netlify-serverless-lambda-functions-using-vs-code-for-your-jamstack-app/5fb0becac03b0e471014fd25/comment/5fcb4d022e4db7780e483068#reply-5fcdeb977d1d8b0b0874852d)

[Michal](https://hashnode.com/@michalhudecek) ,

This is what I'm doing for my current project,

-   I use `netlify dev` for my functions, not netlify-lambda. As [mentioned here](https://github.com/netlify/netlify-lambda) it fits my need to incrementally develop the functions.
-   All my functions are inside a special folder called `functions`.
-   Then defined the `netlify.toml` file with these content,
    
    ```
    [build]
      functions = "functions"
    
    [[redirects]]
      from = "/api/*"
      to = "/.netlify/functions/:splat"
      status = 200
    ```
    
    If you are using `netlify-lambda` I see [an open issue](https://github.com/netlify/netlify-lambda/issues/262) similar to what you face?
    

[Michal](https://hashnode.com/@michalhudecek)

[Dec 7, 2020](https://hashnode.com/posts/how-to-debug-netlify-serverless-lambda-functions-using-vs-code-for-your-jamstack-app/5fb0becac03b0e471014fd25/comment/5fcb4d022e4db7780e483068#reply-5fcdf3017d1d8b0b087485af)

[Tapas Adhikary](https://hashnode.com/@atapas)

I do use `netlify dev`. Yes, the functions are in `/src/lambda` and when I run `netlify dev` they are generated to `/lambda` folder. However, there are no sourcemaps in `/lambda` folder. I believe that is why I get the error about sourcemaps not found.

When I add a break point to any function in `/src/lambda` it is not triggered, because the actual JS that is being run when I call any Netlify function is in `/lambda` folder.

_Where exactly are sourcemaps for lambda functions located in your project?_

[Tapas Adhikary](https://hashnode.com/@atapas)

[Dec 7, 2020](https://hashnode.com/posts/how-to-debug-netlify-serverless-lambda-functions-using-vs-code-for-your-jamstack-app/5fb0becac03b0e471014fd25/comment/5fcb4d022e4db7780e483068#reply-5fcdfa16c5255915c49a8628)

[Michal](https://hashnode.com/@michalhudecek), hmm interesting as I do not see any of the related sourcemaps either. My `functions` folder is outside of the src though as the `src` is meant for having the UI code for me.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1607334214184/_avg92C3N.png)

I see it connects all the time and I am able to debug too..

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1607334257762/DG7Grf9y1.png)

Do you want to debug it out together 😃? We can jump into a 30 mins google meet/zoom call to do that tomorrow. Let me know, I can ping you the meeting id on Twitter.

[Michal](https://hashnode.com/@michalhudecek)

[Feb 11, 2021](https://hashnode.com/posts/how-to-debug-netlify-serverless-lambda-functions-using-vs-code-for-your-jamstack-app/5fb0becac03b0e471014fd25/comment/5fcb4d022e4db7780e483068#reply-6024e35a8a18494dfcecbfb7)

[Tapas Adhikary](https://hashnode.com/@atapas) I finally made it work. I had to add lambda.config.js file and reference to it in package.json scripts. You can check the details here [github.com/netlify/netlify-lambda/issues/262](https://github.com/netlify/netlify-lambda/issues/262)
