mirror of
https://github.com/floci-io/floci.git
synced 2026-11-25 06:47:41 -05:00
feat(lambda): durable function chained invokes (#5164)
* feat(lambda): durable function chained invokes
A CHAINED_INVOKE operation runs another function. A durable target
needs a version or alias and runs as its own durable execution with a
random name; its close completes the operation as SUCCEEDED, FAILED,
TIMED_OUT ("CHAINED_INVOKE timed out after N seconds.") or STOPPED. Any
other function is invoked once, and an output over 1 MB fails the
operation. A missing function or an unqualified durable one fails the
operation at once. Stopping the parent leaves the child running.
A plain chained invoke lost with the process runs again after a restart,
and a durable child that closed before its report reaches the parent
reports then.
* fix(lambda): close the gaps in durable chained invokes
A durable child that closes during a restart reports to its parent
under its own lock, and recovery triggers an execution once. A durable
target invoked without Payload starts its child with no input, while a
plain target gets {}. A target started in the batch that closes the
execution still runs and its result is ignored, as on AWS.
* fix(lambda): reject a chained invoke of another account or region
AWS rejects the checkpoint with InvalidParameterValueException "Cannot
start a CHAINED_INVOKE on a function in another account." or "... in
another region." Cross-account chained invocations are not supported.
* fix(lambda): keep durable chained invokes across a crash
The parent is saved before the child it starts, so a crash in between
leaves no child the parent does not know. On restart a child the parent
recorded but the store lost is started again under the same ARN, and a
plain target started by the checkpoint that closed the execution runs
again until its result is recorded. A child reports only to the
operation that started it.
* fix(lambda): recreate a lost durable child on the version its ARN names
An alias the chained invoke named may point to another version after a
restart, and a child recreated there would not match the ARN the parent
saved.
This commit is contained in:
1 parent
be668acefd
commit
6e6ce61eea
13 files changed
+921
-37
No files matched your search
+10
-3
@@ -168,7 +168,7 @@ background. Invocations through an ARN (EventBridge, Scheduler, function URLs, d
|
||||
durable executions the same way.
|
||||
|
||||
The checkpoint protocol under `/2025-12-01` is the real one, so the Durable Execution SDK works
|
||||
unchanged for steps, waits, step retries, callbacks and replay. Timers are persisted and fired by a
|
||||
unchanged for steps, waits, step retries, callbacks, chained invokes and replay. Timers are persisted and fired by a
|
||||
background sweep, so an execution survives a restart of Floci. A function that returns something
|
||||
other than the `{Status, Result, Error}` envelope fails its execution with
|
||||
`Invalid Status in invocation output.` A function that throws is re-invoked four more times, after
|
||||
@@ -182,6 +182,13 @@ timeout. A failure sent with an empty request body fails the callback but does n
|
||||
function again, as on AWS, so the execution keeps waiting. The SDKs send `{}` when `Error` is
|
||||
omitted, which does invoke it.
|
||||
|
||||
A chained invoke (`context.invoke`) runs another function with an input of up to 1 MB. A durable
|
||||
target needs a version or alias and runs as its own durable execution, and its close completes the
|
||||
operation as `SUCCEEDED`, `FAILED`, `TIMED_OUT` or `STOPPED`. Any other function is invoked once,
|
||||
and an output over 1 MB fails the operation. A missing function or an unqualified durable one
|
||||
fails the operation at once, and a target in another account or Region is rejected at checkpoint.
|
||||
Stopping the parent leaves the child running, as on AWS.
|
||||
|
||||
`GetDurableExecutionHistory` leaves payloads out unless `IncludeExecutionData=true` is sent. The
|
||||
API reference names `true` as the default, but AWS answers this way.
|
||||
|
||||
@@ -194,7 +201,8 @@ package.
|
||||
|
||||
Not emulated yet:
|
||||
|
||||
- Chained invokes (`context.invoke`). They are rejected at checkpoint time.
|
||||
- The execution role's `lambda:InvokeFunction` permission before a chained invoke. `TenantId` is
|
||||
recorded in the history only.
|
||||
- Durable executions started by Step Functions or by an event source mapping. These invoke the
|
||||
function as a plain one.
|
||||
- Payload encryption. `KMSKeyArn` is stored and returned only.
|
||||
@@ -399,7 +407,6 @@ These AWS Lambda operations have no handler in Floci. Calls will return `404` or
|
||||
- Layer permissions (`AddLayerVersionPermission`, `RemoveLayerVersionPermission`, `GetLayerVersionPolicy`)
|
||||
- Provisioned concurrency (`PutProvisionedConcurrencyConfig`, `GetProvisionedConcurrencyConfig`, `ListProvisionedConcurrencyConfigs`, `DeleteProvisionedConcurrencyConfig`)
|
||||
- `InvokeWithResponseStream`
|
||||
- Durable function chained invokes. See Durable Functions
|
||||
- Code signing enforcement. A configuration is created, read, updated, deleted and listed, and
|
||||
nothing verifies a signature against it, so it never gates a deployment. Attaching one to a
|
||||
function is not wired either: there is no `PutFunctionCodeSigningConfig`, so
|
||||
|
||||
Reference in new issue
Block a user