Search posts, tags, users, and pages
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
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,
"program": "${workspaceFolder}\\node_modules\\.bin\\netlify"
If you have netlify globally, please omit the program property altogether.
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.
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..
Tapas Adhikary
Educator @tapaScript | Founder CreoWis & ReactPlay - Writer - YouTuber - Open Source
Tapas Adhikary 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?
Michal ,
This is what I'm doing for my current project,
netlify dev for my functions, not netlify-lambda. As mentioned here it fits my need to incrementally develop the functions.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 similar to what you face?
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?
Michal, 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.

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

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.
Tapas Adhikary 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