Unable to debug lambda code on first request because RIC waits to load handler
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- aws, node.js, typescript
調査の方向性
aws-lambda-ric index.handler エントリーポイントから開始し、最初のリクエストとの相対的な関係で、ランタイムドメインと Node.js プロセスがいつ開始されるかを追跡します。その起動経路を、文書化されている --inspect と --inspect-brk の動作と比較します。RIE/RIC の起動後にデバッガーを起動して接続でき、最初のリクエストが breakpoint に到達する前に接続が完了すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I use the following command to run Runtime Interface Emulator/Runtime Interface Client:
/usr/local/bin/aws-lambda-rie /usr/bin/npx --node-options="--inspect-brk=0.0.0.0:9229" aws-lambda-ric index.handler
I use VS Code to debug my containerized lambda.
Because of the way the RIE or RIC is instrumented, it doesn't load the node process until the first request is initiated.
Because of this the node debugger process doesn't get launched until after the first request. To get around this, I have to issue the request, it hangs because the debugger is waiting for me to attach to it and give it action, then I attach to it, and only then does the debugger start, otherwise the request just sits.
Note: If I use --inspect instead of --inspect-brk then I have to issue two requests. The first request is when the debugger starts. Once the file is loaded, then I attach to the debugger. Now on the second request I can get proper debugging.
Neither solution is adequate. Ideally, I would
- Start the RIE/RIC
- RIE/RIC would start the node process. This would allow the debugger process to start and the dev could attach to it.
- I'd issue my request and it'd stop exactly at the breakpoint where I needed it to be.
Here is my launch.json file
{
"configurations": [
{
"address": "0.0.0.0",
"localRoot": "${workspaceFolder}",
"name": "Attach to Lambda's Node Debugger Process",
"port": 9229,
"remoteRoot": "/var/task",
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"continueOnAttach": true
},
]
}
When I start the program here's what happens:
[INFO] (rapid) exec '/usr/bin/npx' (cwd=/var/task, handler=index.handler)
Then I issue an request. Here's what happens:
[INFO] (rapid) Configuring and starting Operator Domain
[INFO] (rapid) Starting runtime domain
START RequestId: d6fe2e68-87d3-4918-bf02-e96665ad7dfa Version: $LATEST
Debugger listening on ws://0.0.0.0:9229/00b2748e-8cc0-492e-8ecf-5d8517802ef7
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
The program stops here because I've initialized it with the --inspect-brk flag so that I don't need to the request twice. (This is where the inefficiency occurs: The process which starts the runtime domain should get initialized earlier and allow the debugger process to get started.)
I then attach to the debugger port and am able to get to my line of code.
- 主要言語
- TypeScript
- スター
- 224
- フォーク
- 60
- 平均マージ
- 26分
- マージ済み PR(30日)
- 2
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
aws/aws-lambda-nodejs-runtime-interface-client のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
aws/aws-lambda-nodejs-runtime-interface-client#198 · コメント 3 件 · リアクション 6 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
aws/aws-lambda-nodejs-runtime-interface-client#195 · リアクション 12 件 ·
-
bug
aws/aws-lambda-nodejs-runtime-interface-client#170 · コメント 15 件 · リアクション 6 件 · 担当者 1 名 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 38/100
aws/aws-lambda-nodejs-runtime-interface-client#159 · リアクション 2 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
aws/aws-lambda-nodejs-runtime-interface-client#145 · コメント 1 件 · リアクション 6 件 ·
aws/aws-lambda-nodejs-runtime-interface-client の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
copse-dev/agent-pane#2953 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
calcite-components needs triage refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Esri/calcite-design-system#15203 ·