Unable to debug lambda code on first request because RIC waits to load handler
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- aws, node.js, typescript
Rechercherichtung
Beginne beim Einstiegspunkt aws-lambda-ric index.handler und verfolge, wann die Laufzeitdomäne und der Node.js-Prozess im Verhältnis zur ersten Anfrage gestartet werden. Vergleiche diesen Startpfad mit dem dokumentierten Verhalten von --inspect und --inspect-brk. Als abgeschlossen gilt die Aufgabe, wenn der Debugger nach dem Start von RIE/RIC gestartet werden und sich verbinden kann, bevor die erste Anfrage den breakpoint erreicht.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 224
- Forks
- 60
- Ø Merge
- 26 Min.
- Gemergte PRs (30 T.)
- 2
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus aws/aws-lambda-nodejs-runtime-interface-client
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 20/100
aws/aws-lambda-nodejs-runtime-interface-client#198 · 3 Kommentare · 6 Reaktionen ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
aws/aws-lambda-nodejs-runtime-interface-client#195 · 12 Reaktionen ·
-
bug
aws/aws-lambda-nodejs-runtime-interface-client#170 · 15 Kommentare · 6 Reaktionen · 1 zugewiesene Person ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 38/100
aws/aws-lambda-nodejs-runtime-interface-client#159 · 2 Reaktionen ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 42/100
aws/aws-lambda-nodejs-runtime-interface-client#145 · 1 Kommentar · 6 Reaktionen ·
Alle Issues in aws/aws-lambda-nodejs-runtime-interface-client
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
copse-dev/agent-pane#2953 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 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
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
calcite-components needs triage refactor
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
Esri/calcite-design-system#15203 ·