4.37.0
Features
-
New
serverless diffcommand for previewing changes against the deployed stack. Packages the service locally and renders a structured diff — resources, IAM grants, security groups, parameters, outputs — against the CloudFormation stack currently in AWS. AFunction Codesection reports per-function code changes by comparing local zip hashes against each Lambda'sCodeSha256. Especially useful in CI and PR-review workflows.--jsonemits a machine-readable summary;--package <path>reuses an existing artifact directory to skip the auto-package step. Docs. (#13602)serverless diff serverless diff --json serverless diff --package .serverless -
TypeScript files supported in
${file()}variable references. The${file(...)}variable resolver now loads.ts,.mts, and.ctsmodules in addition to JavaScript, with no separate build step required. All export shapes — default object, async default function, named export, named-export function with property selector, and injectedresolveVariable/resolveConfigurationPropertycallbacks — behave identically across JavaScript and TypeScript sources. Docs. (#13590)// scripts/secrets.ts export const getSecrets = async () => ({ apiKey: process.env.API_KEY })custom: secrets: ${file(./scripts/secrets.ts):getSecrets} -
Custom
.envfile locations and explicit opt-out viauseDotenv. Previously a boolean. Now accepts a path or array of paths to load additional.envfiles alongside the local.env/.env.${stage}already loaded automatically — useful for monorepos sharing variables across services.useDotenv: falseis now honored as the documented opt-out. Debug logging atcore:resolver:envsurfaces which files loaded and which keys came from each (visible withSLS_DEBUG=*; keys only, never values). Docs. Closes #10641. (#13597)useDotenv: ../shared # load files from a sibling directory # useDotenv: # …or a list — earlier entries win # - ./overrides.env # - ../ # useDotenv: false # disable all .env loading -
CloudWatch Logs Infrequent Access log class. Opt-in
logs.logGroupClass: infrequent_accessat provider or function level provisions an Infrequent Access log group alongside the standard one, wires Lambda'sLoggingConfig.LogGroupto write to it, and appliesDeletionPolicy: Retainso its history survives stack updates and removals. The standard sibling is always created so pre-existing logs at the default path are preserved during migration. Services that do not opt in produce an identical CloudFormation template. Docs. Closes #12278. (#13601)provider: logs: lambda: logGroupClass: infrequent_access # service-wide default functions: realTimeReports: handler: handler.reports logs: logGroupClass: standard # override per functionNote: AWS does not allow the class of an existing log group to be changed in place.
serverless logs -f <function>cannot read Infrequent Access groups — use CloudWatch Logs Insights instead. Once an IA log group has been retained out of the stack, re-enablinginfrequent_accesslater for the same function will fail withResourceAlreadyExistsExceptionunless the orphaned group is first deleted or imported back into the stack. -
Cognito User Pool
PreTokenGenerationV2_0 and V3_0 triggers. New opt-inlambdaVersionproperty on thecognitoUserPoolevent for thePreTokenGenerationtrigger. Accepted values:V1_0(ID token customization — historic behavior),V2_0(ID and access token customization), andV3_0(V2 capabilities plus machine-to-machine client-credentials grants). When omitted, the emitted CloudFormation is byte-identical to before; existing services see no template diff on upgrade. Docs. Closes #12336. (#13588)functions: preTokenGeneration: handler: preToken.handler events: - cognitoUserPool: pool: MyUserPool trigger: PreTokenGeneration lambdaVersion: V2_0Note: V2_0 and V3_0 require the Cognito Essentials or Plus feature plan.
-
Opt-in Lambda recursive loop detection via
recursiveLoop. Maps 1:1 to the AWS Lambda function property of the same name. Acceptsalloworterminate(default; case-insensitive). By default AWS terminates a function that invokes itself in a loop — setrecursiveLoop: allowfor designs that intentionally rely on this pattern. Docs. Closes #12938. (#13583)functions: hello: handler: handler.hello recursiveLoop: allow -
ECR image retention via
provider.ecr.maxImages. Services that deploy Lambda from container images can now bound how much their ECR repository grows. When set, the framework attaches a lifecycle policy that expires the oldest untagged image versions beyond the configured count. Currently-tagged digests are unconditionally safe — only superseded versions can ever be expired. Default behavior (maxImagesunset) is unchanged. Docs. Closes #12279. (#13584)provider: ecr: scanOnPush: true maxImages: 10 -
Reconcile command works against large organizations.
serverless reconcilepreviously failed with aRequest Entity Too Largeerror against organizations with thousands of instances (e.g. 5000+). Reconciliation now batches the request and parallelizes CloudFormation stack fetching while respecting API rate limits. Docs. (#13596)
Bug Fixes
-
Durable Lambda functions can now be invoked through event sources that wire an unqualified ARN. AWS rejects unqualified invocations of durable functions with
InvalidParameterValueException: You cannot invoke a durable function using an unqualified ARN.The framework now publishes a stable alias and points event sources at it. Closes #13587. (#13589) -
MCP SSE server now binds to loopback only. The MCP server's SSE transport was binding to all network interfaces; it now binds to
127.0.0.1only and installsHost-header validation. Default port (3001) is unchanged. (#13595)
Maintenance
- Bumped the AWS SDK group across one directory with 34 updates (#13605)
- Upgraded
@smithy/util-retry(#13607) - Upgraded
qs(#13604) - Upgraded
protobufjs(#13594) - Upgraded
golang.org/x/moddependency (#13598) - Bumped the
uvgroup across 5 directories (#13593) - Upgraded
brace-expansionandws(#13591)