Unable to debug lambda code on first request because RIC waits to load handler
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- aws, node.js, typescript
Piste de recherche
Commencez par le point d’entrée aws-lambda-ric index.handler et déterminez quand le domaine d’exécution et le processus Node.js sont démarrés par rapport à la première requête. Comparez ce chemin de démarrage au comportement documenté de --inspect et --inspect-brk. Le travail est terminé lorsque le débogueur peut être démarré après le lancement de RIE/RIC et s’y connecter avant que la première requête n’atteigne le breakpoint.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- TypeScript
- Étoiles
- 224
- Forks
- 60
- Merge moyen
- 26 min
- PR mergées (30 j)
- 2
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de aws/aws-lambda-nodejs-runtime-interface-client
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 20/100
aws/aws-lambda-nodejs-runtime-interface-client#198 · 3 commentaires · 6 réactions ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
aws/aws-lambda-nodejs-runtime-interface-client#195 · 12 réactions ·
-
bug
aws/aws-lambda-nodejs-runtime-interface-client#170 · 15 commentaires · 6 réactions · 1 personne assignée ·
-
AWS Inspector findings for curl Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 38/100
aws/aws-lambda-nodejs-runtime-interface-client#159 · 2 réactions ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 42/100
aws/aws-lambda-nodejs-runtime-interface-client#145 · 1 commentaire · 6 réactions ·
Toutes les issues de aws/aws-lambda-nodejs-runtime-interface-client
Issues similaires
-
Browser Waiting for: Product Owner
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
getsentry/sentry-javascript#24577 · 1 commentaire ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
agilepathway/label-checker#640 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
copse-dev/agent-pane#2953 ·
-
[aw] Upgrade available Ouverteagentic-workflows
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100
githubnext/rig#534 ·
-
automation missing-model model-sync provider:pioneer
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
anomalyco/models.dev#7701 ·