Skip to content

AWS SAM Container Error #771

Open
Open
@devinat1

Description

@devinat1

I am trying to run AWS SAM within my devcontainer.
The issue I am encountering is that when I attempt to run the debugger for AWS SAM, I am getting a popup error Cannot reconnect. Please reload the window. or the following:

Command failed: /home/bond/.vscode-server/bin/1a5daa3a0231a0fbba4f14db7ec463cf99d7768e/node /home/bond/.vscode-remote-containers/dist/dev-containers-cli-0.321.0/dist/spec-node/devContainersSpecCLI.js up --container-session-data-folder /tmp/devcontainers-2d4ee239-649b-4417-981c-b7a957c1e7721701400631651 --workspace-folder /home/bond/cs551/ezapigateway/lambda --workspace-mount-consistency cached --id-label devcontainer.local_folder=\\wsl.localhost\Ubuntu\home\bond\cs551\ezapigateway\lambda --id-label devcontainer.config_file=/home/bond/cs551/ezapigateway/lambda/.devcontainer/devcontainer.json --log-level debug --log-format json --config /home/bond/cs551/ezapigateway/lambda/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --mount type=bind,source=/run/user/1000/wayland-0,target=/tmp/vscode-wayland-0e32ef43-fbed-4ede-976c-c1968e4dc575.sock --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root
[56389 ms] Exit code 1
[110010 ms] Start: Run: wsl -d Ubuntu -e wslpath -u \\wsl.localhost\Ubuntu\home\bond\cs551\ezapigateway\lambda

image

I am on WSL on Windows 11.

devcontainer.json:

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
{
	"name": "Debian",
	// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
	"image": "mcr.microsoft.com/devcontainers/base:bullseye",
	"features": {
		"ghcr.io/devcontainers/features/aws-cli:1": {},
		"ghcr.io/devcontainers/features/github-cli:1": {},
		"ghcr.io/devcontainers/features/python:1": {},
		"ghcr.io/customink/codespaces-features/sam-cli:1": {},
		"ghcr.io/joshuanianji/devcontainer-features/aws-cli-persistence:0": {},
		"ghcr.io/devcontainers/features/docker-in-docker:2": {},
	},
	"customizations": {
		"vscode": {
			"extensions": [
				"ms-python.python",
				"amazonwebservices.aws-toolkit-vscode",
				"Gruntfuggly.todo-tree",
				"ms-vscode-remote.remote-ssh",
				"GitHub.copilot"
			]
		}
	}

	// Features to add to the dev container. More info: https://containers.dev/features.
	// "features": {},

	// Use 'forwardPorts' to make a list of ports inside the container available locally.
	// "forwardPorts": [],

	// Configure tool-specific properties.
	// "customizations": {},

	// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
	// "remoteUser": "root"
}

launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "preLaunchTask": "sam build",
            "type": "aws-sam",
            "request": "direct-invoke",
            "name": "SAM Debug - LambdaDemoFunction",
            "invokeTarget": {
                "target": "template",
                "templatePath": "${workspaceFolder}/template.yaml",
                "logicalId": "SellAllFunction"
            },
            "lambda": {
                "runtime": "python3.8",
                "payload": {
                    "path": "${workspaceFolder}/lambda_event.json"
                },
                "environmentVariables": {}
            }
        }
    ]
}

tasks.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "sam build",
            "type": "shell",
            "command": "sam build",
            "problemMatcher": [],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions