Skip to content

Commit 80bcdd8

Browse files
authored
Update README.md
1 parent 378f0b5 commit 80bcdd8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ Minor note: For the `identity` field, since we are not fully emulating Netlify I
441441

442442
## Debugging
443443

444-
To debug lambdas, prepend the `serve` command with [npm's package runner npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b), e.g. `npx --node-arg=--inspect netlify-lambda serve ...`.
444+
To debug lambdas, it can be helpful to turn off minification and enable logging. Prepend the `serve` command with [npm's package runner npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b), e.g. `npx --node-arg=--inspect netlify-lambda serve ...`.
445445

446446
1. make sure that sourcemaps are built along the way (e.g. in the webpack configuration and the `tsconfig.json` if typescript is used)
447447
2. webpack's minification/uglification is turned off (see below):
@@ -455,6 +455,8 @@ module.exports = {
455455
};
456456
```
457457

458+
You can see [a sample project with this setup here](https://github.com/sw-yx/throwaway-test-netlify-lambda).
459+
458460
So you can run something like `npx --node-arg=--inspect netlify-lambda serve --config ./webpack.functions.js`. If using VSCode, it is likely that the `sourceMapPathOverrides` have to be adapted for breakpoints to work. Read here for more info on [how to modify the webpack config](https://github.com/netlify/netlify-lambda/issues/64#issuecomment-429625191).
459461

460462
Netlify Functions [run in Node v8.10](https://www.netlify.com/blog/2018/04/03/node.js-8.10-now-available-in-netlify-functions/) and you may need to run the same version to mirror the environment locally. Also make sure to check that you aren't [committing one of these common Node 8 mistakes in Lambda!](https://serverless.com/blog/common-node8-mistakes-in-lambda/)

0 commit comments

Comments
 (0)