aws-samples / aws-samples/aws-lambda-extensions
Unable to debug with SAM local invoke in Node.js example
- 主要言語
- Go
- スター
- 487
- フォーク
- 144
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Hi all,
in `nodejs-example-extension` example for Node.js platform something during registration phase brakes the debugger when runs locally on VS Code using `sam local invoke --port 6767 ...` on a Lambda that includes this layer.
The following is a snap of the debug logs when launched from VS Code:
```
START RequestId: 05da599b-f76d-494e-905b-bead9860f186 Version: $LATEST
nodejs-example-extension launching extension
Debugger listening on ws://0.0.0.0:6767/95282789-af6d-4c40-b544-b1d70e0650c2
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
hello from extension
register
extensionId 0e16eae5-5e84-4b22-a204-c54424793f69
next
Starting inspector on 0.0.0.0:6767 failed: address already in use
invoke
next
...
```
notice the **Starting inspector on 0.0.0.0:6767 failed: address already in use** error line in logs, after that all set breakpoints are ignored and it's impossible to debug every Lambdas.
this is the VS Code debug task setup:
```
{
"name": "lambda_with_example_layer",
"type": "pwa-node",
"request": "attach",
"address": "localhost",
"port": 6767,
"localRoot": "${workspaceFolder}/lambda_with_example_layer",
"sourceMaps": true,
"remoteRoot": "/var/task",
"protocol": "inspector",
"stopOnEntry": false,
"skipFiles": [
"/**"
]
}
```
Is there any debugger/SAM/Docker configuration that i missed? Or is something else deeper in the layer execution flows that broke debugging in a container with SAM local?
コントリビューションガイド
調査の方向性
`nodejs-example-extension` の例から始め、`sam local invoke --port 6767` を使用して VS Code のアタッチ構成を再現します。`register`、`next`、およびインスペクターの起動前後にある登録フェーズのログを読み、インスペクターがポート 6767 をすでに使用中だと報告する理由を特定します。ローカル呼び出しで正常にアタッチでき、Lambda のブレークポイントが有効になることを完了条件とします。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- node.js
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100