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 }}
This repository has been archived by the owner on Jan 15, 2023. It is now read-only.
I've been having issues getting a vscode debugger to attach to the delve debugger on the lambci/lambda:go1.x container.
I haven't seen any documentation on how to do this. I've gone back through previous MR comments and have gleaned the following:
I need to pass some flags in (from go1.x/run/aws-lambda-mock.go)
I need to compile (macOS) and mount dlv to the container
I need to expose the port that the debugger is running on in order to attach to it
Here is the current command that I'm working with: docker run --rm -e DOCKER_LAMBDA_DEBUG='true' -e DOCKER_LAMBDA_STAY_OPEN=1 -p 9001:9001 -p 5985:5985 -v "$PWD":/var/task:ro,delegated -v "$DLV_PATH":/tmp/lambci_debug_files/dlv lambci/lambda:go1.x test -debug=true
So far the debugger appears to attach (no errors), but I don't see any container logs indicating that dlv has even started (is there supposed to be?). If anyone has any insight as to what I'm doing wrong, it would be much appreciated. I'm also more than happy to contribute to some documentation in order to help others.
The text was updated successfully, but these errors were encountered:
Hi @Balake, I was having this issue too and finally figured it out... and it turns out that the positional args in your docker run command (the arguments and flags after the image lambci/lambda:go1.x) needed to be reordered so that the aws-lambda-mock could parse the flags and the handler correctly. I think that the -debug=true flag was not being read because it wasn't first in the args list (your handler test came first).
Also, you'll know that dlv has started correctly when you see the API server listenaing at: [::]:5985 instead of port 9001.
Here's how I would reorder your command:
docker run --rm -e DOCKER_LAMBDA_STAY_OPEN=1 -p 9001:9001 -p 5985:5985 -v "$PWD":/var/task:ro,delegated -v "$DLV_PATH":/tmp/lambci_debug_files/dlv lambci/lambda:go1.x -debug=true test
I don't think DOCKER_LAMBDA_DEBUG='true' is needed.
Note: there is also a new flag for supporting the api version of delve, which you may want to add before your handler test arg: -delveAPI=2. The default is api-version=1.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I've been having issues getting a vscode debugger to attach to the delve debugger on the lambci/lambda:go1.x container.
I haven't seen any documentation on how to do this. I've gone back through previous MR comments and have gleaned the following:
go1.x/run/aws-lambda-mock.go
)dlv
to the containerHere is the current command that I'm working with:
docker run --rm -e DOCKER_LAMBDA_DEBUG='true' -e DOCKER_LAMBDA_STAY_OPEN=1 -p 9001:9001 -p 5985:5985 -v "$PWD":/var/task:ro,delegated -v "$DLV_PATH":/tmp/lambci_debug_files/dlv lambci/lambda:go1.x test -debug=true
Here is my vscode config:
So far the debugger appears to attach (no errors), but I don't see any container logs indicating that
dlv
has even started (is there supposed to be?). If anyone has any insight as to what I'm doing wrong, it would be much appreciated. I'm also more than happy to contribute to some documentation in order to help others.The text was updated successfully, but these errors were encountered: