question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
justinmk3commented, Aug 12, 2021

In the meantime it seems reasonable for the toolkit to add support for the -bi flag since we already support --use-container

Launch configs can specify sam.buildArguments:

"launch": {
    "configurations": [
      {
        "type": "aws-sam",
        ...
        "sam": {
          "buildArguments": [ "-bi", "..." ]
        }
      }
    ]
  }
0reactions
kyle-wrenncommented, Aug 12, 2021

I believe SAM CLI uses https://github.com/aws/aws-lambda-runtime-interface-emulator but my knowledge is very limited in this area. For more guidance, you’ll want to open an issue here: https://github.com/aws/aws-sam-cli/issues

@justinmk3’s comment works too.

In the meantime it seems reasonable for the toolkit to add support for the -bi flag since we already support --use-container

Thanks. I’ll have to test this out and get back.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use a Private Docker Registry for Real-Time Inference ...
To use a private Docker registry to store your images for SageMaker real-time inference, create a private registry that is accessible from your...
Read more >
Using Docker Image Registries - CloudBees Documentation
Registry Authentication. If you are using private images, you will need to authenticate with the image registries to pull and push from your...
Read more >
AWS Lambda is Unable to find app.handler (Custom Docker ...
It doesn't seems to be installed from the dockerfile. Testing with the RIE gives you the same environment of the lambda so you...
Read more >
"sam build -u -e TARGET_CC=foo" leads to "cargo: Command ...
(base) rvalls@m1 s3-rust-noodles-bam % sam build --debug --use-container -e TARGET_CC=gcc 2021-08-03 12:46:09,833 | Telemetry endpoint ...
Read more >
Storing Serverless Functions on AWS ECR via GitLab
Recently we had to deploy TriggerMesh in an environment where the container registry used was AWS ECR. We usually deploy a private registry ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found