swift-server / swift-aws-lambda-runtime

Swift implementation of AWS Lambda Runtime
Apache License 2.0
1.12k stars 100 forks source link

Debugging locally on a different invocation endpoint #320

Closed jsonfry closed 1 month ago

jsonfry commented 3 months ago

Expected behavior

When debugging locally, you have to send POST requests to /invoke.

I'm trying to use another lambda local tool that is expecting the invoke url to be /2015-03-31/functions/function/invocations, as per the "runtime interface emulator" described here https://docs.aws.amazon.com/lambda/latest/dg/images-test.html

Actual behavior

As this runtime runs it locally on /invoke this of course does not work, and is not changeable

Steps to reproduce

n/a

If possible, minimal yet complete reproducer code (or URL to code)

No response

What version of this project (swift-aws-lambda-runtime) are you using?

1.0.0-alpha.2

Swift version

swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4) Target: arm64-apple-macosx14.0 Darwin *** 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000 arm64

Amazon Linux 2 docker image version

No response

jsonfry commented 3 months ago

Would it be possible to have an environment variable that is picked up that allows the local server to use a different path? I could submit a PR for this.

jsonfry commented 3 months ago

I've been trying to see if the aws lambda client (which https://docs.aws.amazon.com/lambda/latest/dg/images-test.html is using) can be asked to use a completely different invoke endpoint, but the 2015-03-31/functions/*/invocations part is baked in.

sebsto commented 1 month ago

Merged into main https://github.com/swift-server/swift-aws-lambda-runtime/pull/321