aws / aws/aws-toolkit-vscode

debug lambda using private docker registry, --build-image

Open
#1,941 17 comments 0 reactions 0 assignees View on GitHub
guidance needs-response
Dominant language
TypeScript
Stars
2k
Forks
807
Avg merge
10h 12m
Merged PRs (30d)
7

Description

I'm struggling to start a debug session of a local lambda function. I've added a debug configuration and added the following launch config:
```
"launch": {
"configurations": [
{
"type": "aws-sam",
"request": "direct-invoke",
"name": "lambdas:index.handler (nodejs14.x)",
"invokeTarget": {
"target": "code",
"projectRoot": "${workspace}/lambdas",
"lambdaHandler": "index.handler"
},
"lambda": {
"runtime": "nodejs14.x",
"payload": {"json": {
"Records": [
{
"messageId": "19dd0b57-b21e-4ac1-bd88-01bbb068cb78",
"receiptHandle": "MessageReceiptHandle",
"body": "Hello from SQS!",
"attributes": {
"ApproximateReceiveCount": "1",
"SentTimestamp": "1523232000000",
"SenderId": "123456789012",
"ApproximateFirstReceiveTimestamp": "1523232000001"
},
"messageAttributes": {},
"md5OfBody": "{{{md5_of_body}}}",
"eventSource": "aws:sqs",
"eventSourceARN": "arn:aws:sqs:us-east-1:123456789012:MyQueue",
"awsRegion": "us-east-1"
}
]
}},
"environmentVariables": {
}
}
}
]
}
```

If I try and run the `sam local invoke...` manually I get an error when trying to build the docker image. I have a private docker registry that I'm required to use. Maybe I need to change the registry that sam cli is using?

Also, when I try to use the debug configuration it shows a successful build but then pops up with this window:
![Screen Shot 2021-08-12 at 10 09 56 AM](https://user-images.githubusercontent.com/7736656/129211848-0082d496-9e38-4508-b86f-b8165b8f5510.png)

Contributor guide

Open the contributing guide

Research direction

Start with the aws-sam direct-invoke launch configuration and reproduce the failure with sam local invoke. Trace how the Docker image is built and selected for the nodejs14.x Lambda when a private registry is required. Done means the required registry is used and the VS Code debug session starts successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, docker, typescript
Domain
cloud, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.