-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting up debugger with VSCode with Golang Issue #1067
Comments
ok i don't understand now because your template is using main as the handler yet your error is '/var/task/invite' which means this is an old log |
@jackmcguire1 - I apologize, I have to many bash windows open. Copied it from wrong one.
|
i think best case scenario is to start a-fresh and build on that, your current template is full of comments and junk and getting me confused. `AWSTemplateFormatVersion: 2010-09-09 Globals: Resources: Invite: Outputs:
|
Sorry, accidentally closed the issue. @jackmcguire1 - I have used your template to re-create this. Unfortunately same problem. |
@petrogdev I am not sure what you are exactly doing but I am able to debug Go in VSCode. Here were my steps:
In VSCode my launch config is the follow (copied from our docs and added the debug port specified in the command).
I hit
You are seeing a file note found on your binary. Which could mean a couple things,
If you need further help, I encourage you to join our slack channel (details in the repo's README). This is a better place for support from the community and allows us to keep issue focused on Features and Bugs. Closing as not reproducible. |
I had the exact same permissions issue but mine led to a panic nil pointer error. I solved it in my fork like so: charlieblevins/delve@3e1fa9c Initial Issue:
The nil pointer is at line 575 of I'm sure my forked solution is not the best as I do not fully understand the DebugInfoDirectories feature. The root cause is lacking permissions for the current linux user, which causes line 180 in |
I had the exact same permissions issue too.
As far as I checked, delve try to create Actually, @charlieblevins |
I'm having this problem and have not yet found a solution. My steps:
In a new terminal:
Curl hangs right here... The output in the sam terminal:
|
I updated my version of aws-sam-cli from 0.15.0 to 0.16.0 and it started working ... |
@goldeneggg Hey, running into the same issue. Did you manage to find a solution for the error? |
sam: 0.17.0 When following the steps from @jfuss sam hangs at the following line:
The error message looks to be the same as @jfuss output but it is actually different: Executing into the running container, I can verify that there is no /home/sbx_user1051 directory. And as suspected, /home belongs to root and the directory is not created as @goldeneggg has already pointed out. I suspect that the issue does not arise from the missing home directory. Because when dlv fails to load / create it just returns a default config (see https://github.com/go-delve/delve/blob/master/pkg/config/config.go ln 69). |
Description
Permission issue while attempting to execute a curl request on a built binary that should allow me to debug aws lambdas locally.
Steps to reproduce
template.yaml
`AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
invite-bp
Sample SAM Template for invite-bp
More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 5
Resources:
InviteGetFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: ./bin
Handler: main
Runtime: go1.x
Tracing: Active # https://docs.aws.amazon.com/lambda/latest/dg/lambda-x-ray.html
Events:
CatchAll:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /invite
Method: ANY
Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
Variables:
PARAM1: VALUE
InvitePostFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
#Policies:
# - DynamoDBCrudPolicy:
# TableName: !Ref FeelingsPollResults
CodeUri: ./bin
Handler: main
Runtime: go1.x
Tracing: Active # https://docs.aws.amazon.com/lambda/latest/dg/lambda-x-ray.html
Events:
PutRequest:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /invite
Method: POST
Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
Variables:
PARAM1: VALUE
Outputs:
ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
Find out more about other implicit resources you can reference within SAM
https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
InviteAPI:
Description: "API Gateway endpoint URL for Prod environment for First Function"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/invite/"
InviteGetFunction:
Description: "Fetching Invite"
Value: !GetAtt InviteGetFunction.Arn
InviteGetFunctionIamRole:
Description: "Implicit IAM Role created for Invite function"
Value: !GetAtt InviteGetFunctionRole.Arn
InvitePostFunction:
Description: "Creating Invite"
Value: !GetAtt InvitePostFunction.Arn
InvitePostFunctionIamRole:
Description: "Implicit IAM Role created for Invite function"
Value: !GetAtt InvitePostFunctionRole.Arn
`
Observed result
Fetching lambci/lambda:go1.x Docker container image......... 2019-03-18 21:28:09 Mounting /Users/x/go/src/x/x/invite-bp/bin as /var/task:ro inside runtime container Could not create config directory: mkdir /home/sbx_user1051: permission denied.API server listening at: [::]:5858 time="2019-03-19T01:28:10Z" level=info msg="launching process with args: [/var/task/invite]" layer=debugger could not launch process: fork/exec /var/task/invite: no such file or directory
Expected result
Run through vscode debugger step by step in order to determine issues with code.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: SAM CLI, version 0.13.0The text was updated successfully, but these errors were encountered: