Skip to content

Local lambda invocation endpoint env var #321

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

Merged
merged 2 commits into from
May 22, 2024
Merged

Conversation

jsonfry
Copy link
Contributor

@jsonfry jsonfry commented Mar 19, 2024

Allow the changing of the local lambda server's invocation endpoint

Motivation:

[Explain here the context, and why you're making that change. What is the problem you're trying to solve.]

As described in #320 I want to be able to use other tooling that expects the local invocation endpoint to have a specific path, not just /invoke.

Modifications:

I have added an envionrment variable option that lets you override the invocation endpoint url.

Result:

If you set LOCAL_LAMBDA_SERVER_ENABLED to run locally, you can now also set LOCAL_LAMBDA_SERVER_INVOCATION_ENDPOINT to any value to change the path, e.g. to /2015-03-31/functions/function/invocations to match how the "runtime interface emulator" works.

@jsonfry
Copy link
Contributor Author

jsonfry commented Mar 19, 2024

fixes #320

@jsonfry
Copy link
Contributor Author

jsonfry commented May 14, 2024

Is this likely to progress any further?

@tomerd
Copy link
Contributor

tomerd commented May 15, 2024

seems reasonable to me. a test to make sure this works / does not regress would be useful. @sebsto ?

@tomerd
Copy link
Contributor

tomerd commented May 15, 2024

@swift-server-bot test this please

@sebsto
Copy link
Contributor

sebsto commented May 15, 2024

Thank you @jsonfry for submitting this PR.
What happens when LOCAL_LAMBDA_SERVER_INVOCATION_ENDPOINT is not defined ?

@tomerd I think it's a valid use case and we should support the runtime interface emulator.

@jsonfry
Copy link
Contributor Author

jsonfry commented May 15, 2024

What happens when LOCAL_LAMBDA_SERVER_INVOCATION_ENDPOINT is not defined ?

Lambda.env("LOCAL_LAMBDA_SERVER_INVOCATION_ENDPOINT") returns nil, so eventually this line of code is reached: self.invocationEndpoint = invocationEndpoint ?? "/invoke" and it's set to /invoke, as before.

Or in short, it behaves as it did before.

@sebsto
Copy link
Contributor

sebsto commented May 15, 2024

Oh, I missed that line of code. Good for me then.

@sebsto
Copy link
Contributor

sebsto commented May 15, 2024

@tomerd feel free to approve when you have time - thanks

@sebsto
Copy link
Contributor

sebsto commented May 16, 2024

@swift-server-bot test this please

UPDATE : looks like I don't have permissions to trigger a CI test and without test, I can not merge :-(

@sebsto
Copy link
Contributor

sebsto commented May 21, 2024

@tomerd can you trigger a set of test. Apparently, I don't have permissions to do so. Thanks

@tomerd
Copy link
Contributor

tomerd commented May 21, 2024

@swift-server-bot test this please

@sebsto sebsto merged commit 17a993e into swift-server:main May 22, 2024
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants