Skip to content
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

Bug: Cannot attach to debugger for Apple ARM-Based Chip in VS Code #7828

Open
hungnvo opened this issue Jan 9, 2025 · 1 comment
Open

Bug: Cannot attach to debugger for Apple ARM-Based Chip in VS Code #7828

hungnvo opened this issue Jan 9, 2025 · 1 comment
Labels
blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale.

Comments

@hungnvo
Copy link

hungnvo commented Jan 9, 2025

Description:

When attempting to attach a debugger to a locally running AWS Lambda function using the SAM CLI on an Apple ARM-based chip (e.g., M1/M2), the debugger keep hanging and never attached. My guess is potentially due to compatibility issues between the debugger, SAM CLI, and Docker on the ARM architecture.

Steps to reproduce:

  1. Create new directory
mkdir -p ~/.vsdbg
  1. Use Docker to download and install vsdbg for the AWS Lambda runtime container with .NET 6 and copy it to local machine
docker run --rm --mount type=bind,src=~/.vsdbg,dst=/vsdbg --entrypoint bash lambci/lambda:dotnet6.0 -c "curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l /vsdbg"
  1. Build SAM
sam build
  1. SAM local start api
sam local start-api --port 1111 --skip-pull-image --debug-port 5858 --debugger-path ~/.vsdbg --warm-containers EAGER
  1. Start launch.json
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": ".NET Core Docker Attach",
      "type": "coreclr",
      "request": "attach",
      "processId": "1",

      "pipeTransport": {
        "pipeProgram": "sh",
        "pipeArgs": [ 
          "-c",
          "docker exec -i $(docker ps -q -f publish=5858) ${debuggerCommand}"
        ],
        "debuggerPath": "/tmp/lambci_debug_files/vsdbg",
        "pipeCwd": "${workspaceFolder}",
      },
      "sourceFileMap": {
        "/var/task": "${workspaceFolder}"
      }
    }
  ]
}

I attempted to try both run the launch.json file before and after hitting the endpoint to see if it makes any different.

Observed result:

No breakpoint were hit. the debugger keep hanging and never actually attached.

Expected result:

It will actually hit the breakpoints.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: MacOS Apple M3
  2. sam --version: 1.132
  3. Lambda Runtime: dotnet6
{
  "version": "1.132.0",
  "system": {
    "python": "3.13.1",
    "os": "macOS-15.2-arm64-arm-64bit-Mach-O"
  },
  "additional_dependencies": {
    "docker_engine": "27.3.1",
    "aws_cdk": "Not available",
    "terraform": "Not available"
  },
  "available_beta_feature_env_vars": [
    "SAM_CLI_BETA_FEATURES",
    "SAM_CLI_BETA_BUILD_PERFORMANCE",
    "SAM_CLI_BETA_TERRAFORM_SUPPORT",
    "SAM_CLI_BETA_RUST_CARGO_LAMBDA"
  ]
}
@hungnvo hungnvo added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Jan 9, 2025
@roger-zhangg
Copy link
Member

Thanks for reporting, to better understand this issue. If you run sam local invoke to invoke the .Net 6 function, will it also hang, or it only happens when you sam local start-api and try to attach a debugger?

@roger-zhangg roger-zhangg added blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale. and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale.
Projects
None yet
Development

No branches or pull requests

2 participants