Skip to content

Add support for bare Lambda function URLs #21

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 5 commits into from
Nov 1, 2022

Conversation

MPLew-is
Copy link
Contributor

Add request and response object models for invoking Lambda function URLs.

Motivation:

Instead of having to spin up (and pay for) API Gateway endpoints, Lambdas can spin up bare URLs for public access.
There are no existing request or response objects for these requests like there are for other event types.

Modifications:

These payloads are very similar (but not identical to) API Gateway V1 requests, so this is mostly just forked from that and tested until it works with simple requests.
Note that I have only tested completely public endpoints, and cannot speak for the accuracy of the Authorizer sub-type.

Result:

After this change, users will be able to write:

struct FunctionURLHandler: LambdaHandler {
	typealias Event  = FunctionURLRequest
	typealias Output = FunctionURLResponse

	func handle(_ event: Event, context: LambdaContext) async throws -> Output {
		...
	}
}

and then be able to simply invoke their Lambdas without API Gateway:

curl https://abcd1234.lambda-url.{region}.on.aws

MPLew-is added 3 commits July 14, 2022 04:20
[Lambdas can be called with an auto-generated URL](https://docs.aws.amazon.com/lambda/latest/dg/urls-invocation.html), which has a specific format similar but not identical to API Gateway.
Based on real-world testing.
Based on real-world testing.
@swift-server-bot
Copy link

Can one of the admins verify this patch?

5 similar comments
@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@tomerd
Copy link
Contributor

tomerd commented Jul 14, 2022

@swift-server-bot test this please

@MPLew-is
Copy link
Contributor Author

@tomerd I've added some test cases to this - any thoughts on getting this merged?

@tomerd
Copy link
Contributor

tomerd commented Oct 31, 2022

@swift-server-bot test this please

@tomerd tomerd enabled auto-merge (squash) October 31, 2022 17:18
@MPLew-is
Copy link
Contributor Author

MPLew-is commented Nov 1, 2022

@tomerd it looks like the 5.5 and 5.6 builds are currently disabled, don't know if that will impact this being merged.

@tomerd tomerd merged commit 7487b2c into swift-server:main Nov 1, 2022
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