aws-sam-cli icon indicating copy to clipboard operation
aws-sam-cli copied to clipboard

Support runtime provided.al2 for debugging

Open L4B0MB4 opened this issue 2 years ago • 13 comments

When developing a go lambda including a external extension one has to switch to provided.al2. If you want to debug the lambda with

sam local start-api --host 0.0.0.0 -d 5858 --debugger-path dlv --debug-args "-delveAPI=2"

it only works until it builds the docker image. image

How are we not supposed to debug this ?

Also (as a side note) I could have sworn it worked at one point. But after multiple colleagues had this problem I found myself unable to reproduce a working debugger as well - so it might be my dementia.

Any plans on supporting this in the (near) future ?

L4B0MB4 avatar Mar 08 '22 13:03 L4B0MB4

Instead of using the go emulation image, provided runtime will pull the provided lambda emulation image which does not support debugging. We currently don't have plans on supporting this. Tagging it as a feature request.

CoshUS avatar Mar 15 '22 19:03 CoshUS

I'd also like to see this feature implemented. Its very annoying that there is no way to debug a Go Lambda locally at the moment.

alijarjis-pol avatar May 10 '22 10:05 alijarjis-pol

Developing on a mac and generally working on ARM lambdas, not being able to debug is certainly a problem!

shearn89 avatar May 18 '22 09:05 shearn89

Any update on this issue

ravitejaavv avatar Nov 21 '22 06:11 ravitejaavv

Any update on this issue??

ShankaranarayananBR avatar Jan 25 '23 15:01 ShankaranarayananBR

We use lambdas behind API Gateway, and use gin proxy. In order for us to debug our SAM functions in al2 runtime, we've implemented an abstraction that determines if running in AWS - if so, we call lambda.Start with gin proxy, if not, we call a localStart function that starts gin directly.

I'm not aware of any alternatives, but this at least allows us to debug a single function.

mcblair avatar Feb 14 '23 23:02 mcblair

@mcblair could you share a sample repository with an hello world lambda that are you able to debug in local in GoLand or VScode in an M1 Mac please?

sbilello avatar Feb 14 '23 23:02 sbilello

@sbilello Sure, just whipped this up: https://github.com/mcblair/aws-hello-go-lambda

It compiles, I have step-through debugged it in VS Code, on my M1 Mac with arm64. Can sam build and deploy it, too.

mcblair avatar Feb 15 '23 00:02 mcblair

@mcblair Thank you! It should be worth a blog post! I noticed it works nicely on VScode but unfortunately GoLand does not support provided.al2

sbilello avatar Feb 15 '23 07:02 sbilello

@mcblair Thank you! It should be worth a blog post! I noticed it works nicely on VScode but unfortunately GoLand does not support provided.al2

The AWS toolkit & SAM doesn't support provided.al2 for debugging lambdas. To debug that way, go1.x is required and you must debug from an x86_64 machine, M1 macs(or any arm chip) will not work (see https://github.com/aws/aws-sam-cli/discussions/4706).

I was debugging main with F5 in VS Code and stepping through. Debugging in GoLand should work the same way, as it isn't using AWS toolkit or SAM to even be aware of the function runtime.

mcblair avatar Feb 15 '23 07:02 mcblair

Are there any plans on supporting debugging on al2 in the future? Since aws is no longer going to support go1.x we are going to have to create all of our new functions with al2 and having the ability to debug would be nice to say the least.

andrewbohm avatar Sep 14 '23 00:09 andrewbohm

Bump

jackmcguire1 avatar Oct 14 '23 07:10 jackmcguire1

Bump

jledesma-tc avatar Nov 17 '23 21:11 jledesma-tc