This post is a dedicated deep dive into `ServerlessFunction` in Caraer apps and
how it connects to webhook delivery.

## What a ServerlessFunction is

`ServerlessFunction` is linked to an `App`.

Core fields:

- `runtime`
- `code`
- `description`


## Supported runtimes

Current allowed runtimes are:

- `nodejs22`
- `python312`


Validation rejects values outside that allowlist.

## Deployment behavior on save

This means save operations are operationally significant: they can provision or
update cloud infrastructure.

## How this integrates with webhooks

Webhooks can link to a serverless function through
`USES_SERVERLESS_FUNCTION`.

Typical pattern:

1. Define serverless function in the app.
2. Reference that function in webhook configuration.
3. Use webhook delivery mode and filters to control invocation behavior.


## When to use serverless function delivery

Use serverless when you need:

- low-latency processing close to event trigger
- lightweight transformation/enrichment before forwarding
- internal execution without exposing public webhook endpoints


Use HTTP webhook delivery when you need centralized integration handling in your
own backend.

## Operational checklist

- Keep function code idempotent.
- Guard against retries/duplicate webhook events.
- Version function behavior carefully across app updates.
- Monitor cloud function logs and failure rates.