feat: native promises, parallel pruning, skip on no-deploy#82
Open
KennethWKZ wants to merge 5 commits into
Open
feat: native promises, parallel pruning, skip on no-deploy#82KennethWKZ wants to merge 5 commits into
KennethWKZ wants to merge 5 commits into
Conversation
osls v4 removed provider.request() (throws AWS_SDK_V2_SURFACE_REMOVED). Route Lambda calls through lambdaRequest(): on osls v4 build a cached LambdaClient from provider.getAwsSdkV3Config() and send the matching <Method>Command; on serverless v3 keep the original provider.request() path. LambdaClients are cached per provider via a WeakMap. @aws-sdk/client-lambda added as a runtime dependency.
KennethWKZ
force-pushed
the
feat/native-promises-parallel-pruning
branch
from
July 5, 2026 19:04
46f1039 to
6af9109
Compare
AWS SDK v3 Command classes are PascalCase (ListVersionsByFunctionCommand)
but the v2 provider.request action names are camelCase (listVersionsByFunction).
The previous lookup `${action}Command` resolved to undefined and threw
'Command is not a constructor'. Capitalize the action and guard against
unknown commands with a clear error.
KennethWKZ
force-pushed
the
feat/native-promises-parallel-pruning
branch
from
July 5, 2026 19:19
139dfa1 to
bd5141a
Compare
- Drop bluebird in favor of native Promise: mapSeries/each/join chains rewritten as async/await + Promise.all. bluebird removed from deps. - Parallelize old-version deletion with a small bounded-concurrency pMap helper (concurrency 5) instead of deleting one version at a time, keeping AWS Lambda API call rate within safe limits. - Skip pruning when deployment was skipped: postDeploy now treats the noDeploy option robustly (boolean or string) and logs that prune is being skipped. - deleteVersionsForFunction Lambda@Edge handling updated to also recognize AWS SDK v3 error shape (e. + e.message), not just the v2 provider.request e.providerError shape.
KennethWKZ
force-pushed
the
feat/native-promises-parallel-pruning
branch
from
July 5, 2026 19:28
bd5141a to
e8bb37b
Compare
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.
Motivation
Three quality-of-life improvements, none changing user-facing config:
1. Replace
bluebirdwith nativePromiseNative Promise is available everywhere now. All
BbPromise.all/resolve/mapSeries/each/joinusage is rewritten as async/await +Promise.all, andbluebirdis removed from dependencies.2. Skip pruning when the deployment was skipped
postDeploynow treats thenoDeployoption robustly (boolean or string from the CLI) and logs that pruning is being skipped, instead of the previous strict=== truecheck that silently returned.3. Prune old versions in parallel
Function/layer version deletion was strictly sequential (
BbPromise.each). It now runs through a tiny nativepMap(items, mapper, concurrency)helper with concurrency 5 — bounded so the Lambda API call rate stays within normal limits, but many versions are deleted in parallel instead of one at a time. The outer per-function / per-layer loop stays sequential to keep progress output readable.Side fix
deleteVersionsForFunction's Lambda@Edge guard now also recognizes the AWS SDK v3 error shape (e.$metadata.httpStatusCode+e.message), not only the legacyprovider.requeste.providerErrorshape — useful for frameworks that build SDK v3 clients (e.g. osls v4, see #81).Verification
node --check index.jsclean;bluebirdfully removed.pMapverified to preserve input order under bounded concurrency.selectPruneVersions*) or the public options.