Repository navigation
[4.x] Add Lambda Web Functions support with a top-level webFunctions key - #509
Merged
Merged
Conversation
Contributor
|
I much prefer this one to #510 (e.g. for the logs command, much more natural). If that's not the case already, could we enforce uniqueness between functions,i.e. we can't have: functions:
api:
# ...
webFunctions:
api:
# ...(that would be an error) ? That way |
Contributor
Author
|
@mnapoli Already enforced: a web function can't use the key of a function in the same service. It's checked in the initialize hook, so every command gets the error, not just package/deploy, and --function is never ambiguous. |
GrahamCampbell
force-pushed
the
web-functions
branch
from
November 13, 2026 18:19
1feb366 to
b7fce74
Compare
GrahamCampbell
marked this pull request as ready for review
November 13, 2026 22:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lambda Web Functions run a plain Node.js HTTP server behind an HTTPS endpoint that Lambda provides, and osls has no way to deploy one today (#467). This adds a top-level
webFunctionskey next tofunctionsandlayers, with its own closed schema that rejects settings that only make sense for event functions. Keeping web functions out offunctionsspares every consumer offunctions, in core and in plugins, from learning that an entry may not be a Lambda function. New properties use AWS's names (entryPoint,maxConcurrencyPerEnvironment, anendpointblock), properties shared with functions keep their osls names, and the code ships as it is, with nothing added to the zip. A web function cannot reuse the key of a function, so--functionis never ambiguous.Each web function compiles to an
AWS::Lambda::WebFunction, anAWS::Lambda::WebFunctionRevisionand anAWS::Lambda::WebFunctionEndpointin the service stack, with its two log groups and a URL output. CloudFormation has no auto-deploy mode for endpoints, so the endpoint always routes all traffic to the stack's revision, and a change to the code or to a setting of the revision replaces it behind the same URL. Theendpointblock sets IAM auth, the scaling and rate limits and the endpoint type, and itsnamelets a new endpoint replace one whose type or Regions change, which Lambda cannot update in place. The default role may write the.locallog group in every Region, without which replica Regions silently drop their logs. Custom domains through CloudFront and VPC access through a network connector stay documented recipes underresources.Lambda keeps referring to the exact S3 object version of a revision's zip for as long as the revision exists, so the deployment bucket has to be versioned and has to let Lambda read it. When osls creates the bucket,
provider.deploymentBucket.versioning: trueis required, and the bucket policy gets a statement that lets Lambda read on behalf of the account's web functions, naming none so that a rename cannot take the access away from a revision that still serves. Before the upload osls checks versioning, enabling it directly on its own bucket when the stack has not done so yet, and checks the policy of a bucket the user names. Each zip is stored once under a key derived from its content, outside the per-deployment directories, so a revision is replaced only when its own zip or settings change, and cleanup of old deployments never removes code a revision still references. Express mode with rollback disabled is rejected forpackage,deployand arollbackto a deployment with web functions, because CloudFormation refuses the revision replacements that most changes make and leaves the stack inUPDATE_FAILED.infolists the URLs,logs --functionaccepts a web function, anddeploy function,rollback function,invoke,invoke localandmetrics --functionexplain that they do not apply.