Skip to main content
You invoke a local Function by name. You invoke a deployed Function by ID.

Invoke a local Function

Start the development server:
Send a request to the local Function name:
The local server runs the Function synchronously and returns the handler’s result in the response.

Invoke a deployed Function

Send a POST request with the Function ID:
The production API returns 202 Accepted with an invocation object. The invocation starts in PENDING or RUNNING. See Invoke a Function for the complete request and response schema.

Pass parameters

Set params to the JSON object that your handler receives:
The serialized params object can contain up to 64 KB. Define a Zod parametersSchema to reject invalid input.

Override session settings

sessionConfig in defineFn supplies the browser defaults for every invocation. Set sessionCreateParams in an invoke request to override supported fields for one run:
Browserbase deep-merges sessionCreateParams over the Function version’s sessionConfig. Invocation values win. Defaults that you don’t override remain unchanged. sessionCreateParams doesn’t support region or keepAlive. Set timeout from 60 through 900 seconds. The default is 900 seconds.

Get the result

Poll the invocation by the id returned from the invoke request:
An invocation can have these statuses: See Get an invocation for the response schema.

Use a webhook instead of polling

Subscribe an endpoint to:
  • functions.invocations.completed
  • functions.invocations.failed
Browserbase calls your endpoint when the invocation reaches a terminal state. See Webhooks for delivery and signature verification. Builds emit equivalent functions.builds.running, functions.builds.completed, and functions.builds.failed events.

Inspect builds, logs, and sessions

Use these resources when a publish or invocation fails: Every invocation has a sessionId. Use it with Browserbase’s session observability tools to inspect console messages, network activity, and the recording.

Functions limits

Check the timeout, region, bundle size, and storage constraints.