Lambda ARM (Apple M1): AWS SAM Golang lambda debugging does not work #4706
Replies: 34 comments 7 replies
-
Hello, just checking in to see if there is any update on this. My self interest here is to be able to work with Go based Lambdas on my M1 Mac and not rely on an intel based system, which is what I am doing now for just those Lambdas we use Go for. At the least it would be good to get some understanding regarding what is the cause for this issue from the aws-sam-cli team point of view? |
Beta Was this translation helpful? Give feedback.
-
Hey @ashprao, sorry for the late response. I confirmed that Go lambdas can be successfully debugged on x86 based Apple Macs. But I personally don't have a M1 Mac, I'll ask a team member to help with this. |
Beta Was this translation helpful? Give feedback.
-
Hello @hawflau, Thanks for getting to this. Would love to be able fully switch to my M1 based Mac for all of my development. :-) To add more context. I did try debugging after updating, AWS CLI, AWS SAM, VS Code, VS Code AWS Toolkit to the latest versions and I am still facing the issue. Additional environment details (Ex: Windows, Mac, Amazon Linux etc)OS: macOS Big Sur 11.6 (M1) / Darwin arm64 20.6.0 |
Beta Was this translation helpful? Give feedback.
-
Hello @hawflau, just checking in to see if your colleagues have had any success in reproducing this, and if so, whether there is a resolution or workaround that can be made available in the near term. |
Beta Was this translation helpful? Give feedback.
-
Hi @hawflau, apologies for the second ping on this. Any luck with having this reproduced? If this is an issue with my setup only, then I would be happy to get some pointers to figure out how to resolve it? But I am hoping that this is a bug that would have an ETA for a fix. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
-
Any update to this? I seem to be able to run this without debugging just fine as @ashprao |
Beta Was this translation helpful? Give feedback.
-
bump @jfuss |
Beta Was this translation helpful? Give feedback.
-
Any update on this @hawflau? I am also facing the issue with my M1 Pro. |
Beta Was this translation helpful? Give feedback.
-
@aahung can you help with this |
Beta Was this translation helpful? Give feedback.
-
I am having the same issue.
|
Beta Was this translation helpful? Give feedback.
-
Same issue here: debug run fails on an M1 MacBook. |
Beta Was this translation helpful? Give feedback.
-
Just checked again with version 1.38.0. Problem persists.
|
Beta Was this translation helpful? Give feedback.
-
@jackmcguire1 @aahung |
Beta Was this translation helpful? Give feedback.
-
any updates? |
Beta Was this translation helpful? Give feedback.
-
Any updates here? |
Beta Was this translation helpful? Give feedback.
-
@georgedimac Unfortunately, that's related to this. |
Beta Was this translation helpful? Give feedback.
-
Any update on this issue? |
Beta Was this translation helpful? Give feedback.
-
Having a similar issue on M2 Dockerfile:
Logs when running debugger via vscode:
|
Beta Was this translation helpful? Give feedback.
-
Thank you for raising this issue. It seems that the issue is related to the fact that Go Lambda functions can only run on x86_64 architecture (https://docs.aws.amazon.com/lambda/latest/dg/lambda-golang.html), and that Docker Desktop does not support running containers using this architecture (see these issues docker/for-mac#5191 (comment), aws/aws-toolkit-vscode#2020). As a workaround, you can use Colima instead of Docker Desktop allows you to start the container as x86_64 architecture. I tried this workaround and worked fine. These are the steps:
I hope this information helps, and please let me know if there is anything else I can assist with. |
Beta Was this translation helpful? Give feedback.
-
Thanks @moelasmar! This is great info. I will try it out when I get a chance. Much appreciate the update. In the meantime I am wondering if you or anybody else in the forum has insights into if and when Go lambdas will be supported on arm64 architectures. Also, I did briefly try to use the provided.al2 runtime as described here - Migrating AWS Lambda functions to Amazon Linux 2. I was not successful in getting this working, but I did not really persevere, I must admit, and this was a while back. We have continued development with local debugging rather than running the Go code as lambdas in debugging mode as a stop gap, which is largely okay unless you are trying to debug issues relating to the code running in the Lambda context. But it would be great to get Go Lambdas debuggable in Macs with M1 architectures out of the box as we do in Intel systems. My intel based Mac is nearing 10 years and I am not planning on getting a new Intel based Mac moving forward. :-) |
Beta Was this translation helpful? Give feedback.
-
Hi, |
Beta Was this translation helpful? Give feedback.
-
Hi @dkosasih, |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick reply @moelasmar. |
Beta Was this translation helpful? Give feedback.
-
Thank you @dkosasih .. I will check it later |
Beta Was this translation helpful? Give feedback.
-
Hi @moelasmar, thanks for the reply. I've tried following your instructions but receive the following still:
A cursory glance at Google indicates that this is a problem with delve running on arm architecture. I followed all previous steps including compiling for amd64, I also tried compiling natively on a Ryzen powered system I have next to me and had no luck with this either. At this point we're largely engineered our way around being dependant on local sam debugging by having extensive unit tests but it would be nice to be able to debug from the context of a Lambda. |
Beta Was this translation helpful? Give feedback.
-
Hello @benanderton, I appreciate your feedback. I encountered a similar issue when trying to utilize Delve. When I used the M1 Mac compiled version on Colima or the Intel Mac compiled version on Docker Desktop, I received the same error. However, I did not have any problems when I used the Intel Mac compiled version on Colima. Unfortunately, I do not know why it is not working for you. |
Beta Was this translation helpful? Give feedback.
-
We are moving this issue to a discussion thread because it is related to the development setup and aligning it with the architecture of the Lambda function, rather than being directly related to SAM CLI. |
Beta Was this translation helpful? Give feedback.
-
Issue still exists. Do we have an update here ? |
Beta Was this translation helpful? Give feedback.
-
@jfuss isit possible to use AWS finch as a work around instead, planning on getting an M2 soon, so this will help! |
Beta Was this translation helpful? Give feedback.
-
Hi, I got it working finally on M1 mac. But I'm currently unable to pass a JSON file as an input to my lambda. I am still trying to figure that out. Here are the steps that worked for me. I am extending the instructions provided by @moelasmar above.
Change credSStore to credStore as described in https://stackoverflow.com/a/68202428 The file should look like this:
EXTRA BONUS TIP: I just had to change the sam command to pass the JSON event file.
|
Beta Was this translation helpful? Give feedback.
-
Description:
After creating a plain vanilla AWS SAM application with
sam init
forgolang
, and then using the AWS Toolkit provided code lens in VS Code, to create an AWS SAM template file based debug configuration, I get the following error when trying to debug the lambda code.Running the code without debugging works.
Note:
I had raised this issue in
aws/aws-toolkit-vscode
as aws/aws-toolkit-vscode#2020. There was a suggestion in that thread that I should raise an issue here.Steps to reproduce:
sam init
.Hello world
template.Observed result:
From the output listed above, it seems to me that when using the debugger, it thinks that the function is not implemented.
2021-09-11 10:55:07 [INFO]: Waiting for SAM application to start...
could not launch process: fork/exec /var/task/hello-world: function not implemented
Other considerations
sam local invoke
on M1 based Apple Macs.Expected result:
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: 1.31.0Beta Was this translation helpful? Give feedback.
All reactions