Skip to content

Debugging SAM app crashes when using using Podman #8415

@shareefer

Description

@shareefer

Problem

Unable to debug an AWS SAM app using the toolkit with Podman installed. Podman works fine via SAM CLI sam local invoke.

Steps to reproduce the issue

  1. Install Podman Desktop 1.23.1
  2. Make sure Docker Compatibility is enabled and Podman is listening on Docker socket
  3. Setup Node Hello World project using the SAM CLI
  4. Open VS Code, setup launch.json using the VS Toolkit extension helper in the template.yaml
  5. Run Debugging

Expected behavior

SAM debugging to run without issue just like it does with Docker

System details (run AWS: About and/or Amazon Q: About)

2025-12-11 14:37:01.676 [info] Manifest file is changed (new hash: c0e83ff3ce1bd02a0c2a7c02974c24ec) or dependency folder (.aws-sam/deps/e97960d3-f967-4c11-bb67-c0f9409291db) is missing for (HelloWorldFunction), downloading dependencies and copying/building source
Building codeuri: /Users/sedenfield/Documents/Gitlab/_scratchpad/sam-pod-test/sam-app/hello-world runtime: nodejs24.x architecture: arm64 functions: HelloWorldFunction
2025-12-11 14:37:01.684 [info] Running NodejsNpmBuilder:NpmPack
2025-12-11 14:37:02.156 [info] Running NodejsNpmBuilder:CopyNpmrcAndLockfile
2025-12-11 14:37:02.156 [info] Running NodejsNpmBuilder:CopySource
2025-12-11 14:37:02.157 [info] Running NodejsNpmBuilder:NpmInstall
2025-12-11 14:37:02.772 [info] Running NodejsNpmBuilder:NpmTest
 Running NodejsNpmBuilder:CleanUp
2025-12-11 14:37:02.772 [info] Running NodejsNpmBuilder:CopyDependencies
2025-12-11 14:37:02.955 [info] Running NodejsNpmBuilder:CleanUpNpmrc
 Running NodejsNpmBuilder:LockfileCleanUp
2025-12-11 14:37:02.955 [info] Running NodejsNpmBuilder:LockfileCleanUp
2025-12-11 14:37:03.051 [info] Build Succeeded
2025-12-11 14:37:03.051 [info] Built Artifacts  : ../../../../../../../private/tmp/aws-toolkit-vscode/vsctkb70ed838/output
Built Template   : ../../../../../../../private/tmp/aws-toolkit-vscode/vsctkb70ed838/output/template.yaml

Commands you can use next
=========================
[*] Validate SAM template: sam validate
[*] Invoke Function: sam local invoke -t ../../../../../../../private/tmp/aws-toolkit-vscode/vsctkb70ed838/output/template.yaml
[*] Test Function in the Cloud: sam sync --stack-name {{stack-name}} --watch
[*] Deploy: sam deploy --guided --template-file ../../../../../../../private/tmp/aws-toolkit-vscode/vsctkb70ed838/output/template.yaml
2025-12-11 14:37:05.446 [info] Invoking app.lambdaHandler (nodejs24.x)
2025-12-11 14:37:05.459 [info] Local image was not found.
2025-12-11 14:37:05.459 [info] Removing rapid images for repo public.ecr.aws/sam/emulation-nodejs24.x
2025-12-11 14:37:05.465 [info] Building image...
2025-12-11 14:37:06.444 [info] .
2025-12-11 14:37:06.444 [info] .
2025-12-11 14:37:07.394 [info] .
2025-12-11 14:37:07.395 [info] ...
2025-12-11 14:37:07.395 [info] ...
2025-12-11 14:37:12.586 [info] .
2025-12-11 14:37:12.589 [info] .
2025-12-11 14:37:12.604 [info] .
2025-12-11 14:37:13.729 [info] .
2025-12-11 14:37:13.734 [info] .
2025-12-11 14:37:13.891 [info] .
2025-12-11 14:37:14.285 [info] .
2025-12-11 14:37:14.286 [info] .
2025-12-11 14:37:14.309 [info] ....
2025-12-11 14:37:14.314 [info] 
2025-12-11 14:37:14.330 [info] Using local image: public.ecr.aws/lambda/nodejs:24-rapid-arm64.

Mounting /tmp/aws-toolkit-vscode/vsctkb70ed838/output/HelloWorldFunction as /var/task:ro,delegated, inside runtime container
2025-12-11 14:37:14.354 [info] SAM_CONTAINER_ID: dfe0744e69f1e75bbd38ba9955051649343b866f577d197ffa9f888f0ec55ef4
2025-12-11 14:37:14.577 [info] START RequestId: e141026f-03aa-44c5-a323-4438f7893d85 Version: $LATEST
2025-12-11 14:37:14.593 [info] Debugger listening on ws://0.0.0.0:5858/9321b515-bbec-4574-94eb-90a0081ca1d8
For help, see: https://nodejs.org/en/docs/inspector
2025-12-11 14:37:14.797 [info] Debugger attached.
2025-12-11 14:37:14.917 [info] 2025-12-11T22:37:14.940Z	-	ERROR	Init Error 	{"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot find module 'app'\nRequire stack:\n- /var/runtime/index.mjs","name":"Runtime.ImportModuleError","stack":["Runtime.ImportModuleError: Error: Cannot find module 'app'","Require stack:","- /var/runtime/index.mjs","    at loadModule (file:///var/runtime/index.mjs:573:13)","    at async UserFunctionLoader.load (file:///var/runtime/index.mjs:504:20)","    at async createRuntime (file:///var/runtime/index.mjs:1217:52)","    at async ignition (file:///var/runtime/index.mjs:1633:21)"]}
2025-12-11 14:37:14.921 [info] Waiting for the debugger to disconnect...
2025-12-11 14:37:14.927 [info] node:internal/process/promises:394
    triggerUncaughtException(err, true /* fromPromise */);
    ^

ImportModuleError [Runtime.ImportModuleError]: Error: Cannot find module 'app'
Require stack:
- /var/runtime/index.mjs
    at loadModule (file:///var/runtime/index.mjs:573:13)
    at async UserFunctionLoader.load (file:///var/runtime/index.mjs:504:20)
    at async createRuntime (file:///var/runtime/index.mjs:1217:52)
    at async ignition (file:///var/runtime/index.mjs:1633:21)

Node.js v24.11.0
2025-12-11 14:37:14.935 [info] 11 Dec 2025 22:37:14,951 [ERROR] (rapid) Init failed error=Runtime exited with error: exit status 1 InvokeID=
11 Dec 2025 22:37:14,951 [ERROR] (rapid) Invoke failed error=Runtime exited with error: exit status 1 InvokeID=e9251df1-2dab-4ba6-9928-ea5b29d59a76
11 Dec 2025 22:37:14,951 [ERROR] (rapid) Invoke DONE failed: Sandbox.Failure
2025-12-11 14:37:15.938 [info] {"errorType": "Runtime.ImportModuleError", "errorMessage": "Error: Cannot find module 'app'\nRequire stack:\n- /var/runtime/index.mjs", "trace": ["Runtime.ImportModuleError: Error: Cannot find module 'app'", "Require stack:", "- /var/runtime/index.mjs", "    at loadModule (file:///var/runtime/index.mjs:573:13)", "    at async UserFunctionLoader.load (file:///var/runtime/index.mjs:504:20)", "    at async createRuntime (file:///var/runtime/index.mjs:1217:52)", "    at async ignition (file:///var/runtime/index.mjs:1633:21)"]}
2025-12-11 14:37:15.938 [info] 
2025-12-11 14:37:17.048 [info] 
2025-12-11 14:37:17.048 [info] Command stopped: "sam local invoke"
Image

Podman podman-machine-deafault.json below is what the default podman machine creates

  "Created": "2025-12-11T14:35:37.929118-08:00",
  "GvProxy": {
    "Debug": false,
    "MTU": 0,
    "LogFile": "",
    "PidFile": "",
    "SSHPort": 0
  },
  "HostUser": {
    "Rootful": true,
    "UID": 503,
    "HostUserModified": false
  },
  "LastUp": "0001-01-01T00:00:00Z",
  "Mounts": [
    {
      "OriginalInput": "",
      "ReadOnly": false,
      "Source": "/Users",
      "Tag": "a2a0ee2c717462feb1de2f5afd59de5fd2d8",
      "Target": "/Users",
      "Type": "virtiofs",
      "VSockNumber": null
    },
    {
      "OriginalInput": "",
      "ReadOnly": false,
      "Source": "/private",
      "Tag": "71708eb255bc230cd7c91dd26f7667a7b938",
      "Target": "/private",
      "Type": "virtiofs",
      "VSockNumber": null
    },
    {
      "OriginalInput": "",
      "ReadOnly": false,
      "Source": "/var/folders",
      "Tag": "a0bb3a2c8b0b02ba5958b0576f0d6530e104",
      "Target": "/var/folders",
      "Type": "virtiofs",
      "VSockNumber": null
    }
  ],
  "Name": "podman-machine-default",
  "Resources": {
    "CPUs": 4,
    "DiskSize": 93,
    "Memory": 3814,
    "USBs": []
  },
  "SSH": {
    "IdentityPath": "/Users/sedenfield/.local/share/containers/podman/machine/machine",
    "Port": 57727,
    "RemoteUsername": "core"
  },
  "Version": 1,
  "Swap": 0,
  "ImagePath": {
    "Path": "/Users/sedenfield/.local/share/containers/podman/machine/libkrun/podman-machine-default-arm64.raw"
  },
  "LibKrunHypervisor": {
    "KRun": {
      "LogLevel": "panic",
      "Endpoint": "http://localhost:57780",
      "BinaryPath": null,
      "VirtualMachine": {
        "vcpus": 4,
        "memoryBytes": 3999268864,
        "bootloader": {
          "kind": "efiBootloader",
          "efiVariableStorePath": "/Users/sedenfield/.local/share/containers/podman/machine/libkrun/efi-bl-podman-machine-default",
          "createVariableStore": true
        }
      },
      "Rosetta": false
    }
  },
  "Starting": false,
  "Rosetta": false,
  "Ansible": {
    "PlaybookPath": "/home/core/playbook.yaml",
    "Contents": "---\n- name: Create a symbolic link for registries.conf from host to VM\n  hosts: localhost\n  become: true\n  tasks:\n    - name: Create symbolic link with sudo from the host\n      command: sudo ln -s /Users/sedenfield/.config/containers/registries.conf /etc/containers/registries.conf.d/999-podman-desktop-registries-from-host.conf\n",
    "User": "core"
  }
}
  • OS: macOS 26.1
  • Visual Studio Code version: 1.107.0
  • AWS Toolkit version: 3.90.0
  • Amazon Q version: n/a

Thank you for taking a look.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugWe can reproduce the issue and confirmed it is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions