You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to debug lambda code on first request because RIC waits to load handler #75
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.
[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.
I came to this repo looking for the same thing but for a C# Lambda. I want to:
Run a docker image which has the runtime in it
Press debug on my Lambda code, which is pointing to the runtime started in 1
Make a request to the runtime from 1 to invoke the Lambda run in 2
This approach is possible, using a custom runtime (for example one written in Go here), but it feels like the contents of this repo should be able to do this with a small tweak? It just isn't covered in the possible ways to run - there's only 'including your lambda code in image' or 'run RIE on your computer, then build your lambda into a container, and point the lambda in the container at your computer', it seems a small difference to 'run RIE in container, point your local code at the container and run it'.
Activity
lgt commentedon Jun 23, 2024
I'm interested too, how can we run debugger properly with RIC in VSCODE
IanGraingerGMSL commentedon Jun 23, 2025
I came to this repo looking for the same thing but for a C# Lambda. I want to:
This approach is possible, using a custom runtime (for example one written in Go here), but it feels like the contents of this repo should be able to do this with a small tweak? It just isn't covered in the possible ways to run - there's only 'including your lambda code in image' or 'run RIE on your computer, then build your lambda into a container, and point the lambda in the container at your computer', it seems a small difference to 'run RIE in container, point your local code at the container and run it'.