Call another Handler
Invoke child Handlers and understand the limits shared by the Run tree.
Applies to
CLIConsoleAPI
Use env.handler() to call another saved Handler in your account.
This example passes text to a Handler named normalize.
Deploy that Handler first.
export default async function (event, env) {
return env.handler('normalize').run({ text: event.text })
}
The called Handler uses its own Connections, Secrets, and Database. It does not inherit a Web App's viewer information.
Check the history
The called Handler is recorded as a child Run.
Its triggerKind is internal-handler-invoke.
History shows its parent Run and the Run that started the chain.
Child Run limits
| Item | Limit |
|---|---|
| Call depth | 5 |
| Total calls from one root Run | 16 |
| Event and result | 500 KiB each |
| JSON depth | 64 |
| JSON values | 10,000 |
| Items in one array | 1,000 |
| Properties in one object | 256 |
| One string | 256 KiB |
| All strings combined | 512 KiB |
Child Runs count toward the same per-minute, per-hour, and daily time limits. All calls must finish before the original Run's deadline. Splitting the work across Handlers does not extend plan limits or the deadline.