Skip to content

Running RIE with Go-based Lambda + Delve debugger? #139

Open
@skyzyx

Description

@skyzyx

I'm currently using RIE to run my compiled Go binary.

#!/bin/sh

if [ -z "${AWS_LAMBDA_RUNTIME_API}" ]; then
    exec /usr/local/bin/aws-lambda-rie /var/runtime/bootstrap
else
    exec /var/runtime/bootstrap
fi

However, I also want to run Delve, the Go debugger, against my binary.

exec dlv exec --headless --listen :4040 /var/runtime/bootstrap

I've tried combining the commands in different ways to get both RIE and Delve to work, to no avail.

Example: Delve first

exec dlv exec --headless --listen :4040 /usr/local/bin/aws-lambda-rie /var/runtime/bootstrap

In this case, Delve tries to debug RIE.

Example: RIE first

exec /usr/local/bin/aws-lambda-rie dlv exec --headless --listen :4040 /var/runtime/bootstrap

In this case, RIE only seems to run Delve during the lifetime of a request to my Lambda function.

Example: Running in background and capturing PID

PID="$(exec /usr/local/bin/aws-lambda-rie /var/runtime/bootstrap &)"

dlv attach --headless --listen :4040 $PID

In this case, RIE doesn't move into the background. It stays in the foreground, and Delve never runs.

Any ideas would be welcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions