Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/guides/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ Durable functions require qualified Lambda invocations. When `durableConfig` is

CloudFormation marks the top-level `AWS::Lambda::Function.DurableConfig` property as a replacement property: adding `durableConfig` to an already deployed function, or removing it, requires CloudFormation to replace the Lambda function. osls gives Lambda functions explicit names, so CloudFormation cannot perform the replacement invisibly; a replacement-requiring update of a custom-named resource fails and forces an explicit migration. Changing `executionTimeout` or `retentionPeriodInDays` values on an existing durable function updates with no interruption; osls publishes a new version and retargets the `durable` alias. Plan enable or disable migrations carefully, for example by deploying a new function name, shifting event sources, or recreating the stack when appropriate.

When using Lambda event source mappings, durable execution timeout must be 900 seconds or less. Event source mappings invoke durable functions synchronously through the generated `durable` alias. AWS Lambda Durable Functions support dead-letter queues and event source mapping destinations, but do not support Lambda asynchronous destinations configured through `functions[].destinations`. Functions configured with `durableConfig` also cannot declare `cloudFront` (Lambda@Edge) events.
When using Lambda event source mappings, durable execution timeout must be 1800 seconds or less. Event source mappings invoke durable functions synchronously through the generated `durable` alias. AWS Lambda Durable Functions support dead-letter queues and event source mapping destinations, but do not support Lambda asynchronous destinations configured through `functions[].destinations`. Functions configured with `durableConfig` also cannot declare `cloudFront` (Lambda@Edge) events.

Event source mappings do not support durable execution-name idempotency at launch. If retries must not start duplicate durable executions, implement idempotency in your function code or use an intermediary standard Lambda function that invokes the durable function with a `DurableExecutionName`.

Expand Down
6 changes: 3 additions & 3 deletions lib/plugins/aws/package/compile/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const isS3Destination = (destinationsProperty) =>
// INVARIANT: this set must list every function event key that compiles to an
// AWS::Lambda::EventSourceMapping (poll-based; invokes durable functions synchronously).
// If a new ESM-backed event type is added (e.g. DocumentDB change streams), add its key
// here so the 900s synchronous-ESM durable executionTimeout cap keeps applying.
// here so the 1800s synchronous-ESM durable executionTimeout cap keeps applying.
const durableEventSourceMappingEventKeys = new Set([
'sqs',
'stream',
Expand All @@ -86,7 +86,7 @@ const durableEventSourceMappingEventKeys = new Set([
'rabbitmq',
]);

const durableEventSourceMappingMaxExecutionTimeout = 900;
const durableEventSourceMappingMaxExecutionTimeout = 1800;

// https://docs.aws.amazon.com/lambda/latest/dg/durable-supported-runtimes.html
const durableSupportedManagedRuntimes = new Set([
Expand Down Expand Up @@ -936,7 +936,7 @@ class AwsCompileFunctions {
functionObject.durableConfig.executionTimeout > durableEventSourceMappingMaxExecutionTimeout
) {
throw new ServerlessError(
`Function "${functionName}" uses an event source mapping with "durableConfig.executionTimeout" greater than 900 seconds. AWS Lambda event source mappings invoke durable functions synchronously and require durable execution timeout to be 15 minutes or less.`,
`Function "${functionName}" uses an event source mapping with "durableConfig.executionTimeout" greater than 1800 seconds. AWS Lambda event source mappings invoke durable functions synchronously and require durable execution timeout to be 30 minutes or less.`,
'DURABLE_FUNCTION_ESM_TIMEOUT_UNSUPPORTED'
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/aws/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ class AwsProvider {
},
],
},
awsLambdaTimeout: { type: 'integer', minimum: 1, maximum: 900 },
awsLambdaTimeout: { type: 'integer', minimum: 1, maximum: 1800 },
awsLambdaTracing: { anyOf: [{ enum: ['Active', 'PassThrough'] }, { type: 'boolean' }] },
awsLambdaVersioning: { type: 'boolean' },
awsDeletionProtection: {
Expand Down
8 changes: 4 additions & 4 deletions test/unit/lib/plugins/aws/package/compile/functions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1990,7 +1990,7 @@ describe('AwsCompileFunctions', () => {
});
});

it('should reject durableConfig over 900 seconds with event source mappings', async () => {
it('should reject durableConfig over 1800 seconds with event source mappings', async () => {
const events = [
{ sqs: 'arn:aws:sqs:region:account:MyQueue' },
{ stream: 'arn:aws:dynamodb:region:account:table/foo/stream/1' },
Expand Down Expand Up @@ -2035,7 +2035,7 @@ describe('AwsCompileFunctions', () => {
basic: {
runtime: 'nodejs24.x',
durableConfig: {
executionTimeout: 901,
executionTimeout: 1801,
},
events: [event],
},
Expand All @@ -2050,15 +2050,15 @@ describe('AwsCompileFunctions', () => {
}
});

it('should support durableConfig with event source mappings at 900 seconds', async () => {
it('should support durableConfig with event source mappings at 1800 seconds', async () => {
const { awsNaming, cfTemplate } = await runServerless({
fixture: 'function',
configExt: {
functions: {
basic: {
runtime: 'nodejs24.x',
durableConfig: {
executionTimeout: 900,
executionTimeout: 1800,
},
events: [
{
Expand Down