BlueForge Docs

client.functions.invoke

Invoke an edge function by name.

Signature

class Client {
  functions: {
    invoke<T = unknown>(name: string, body?: unknown): Promise<{ data: T; latencyMs: number }>
  }
}

Parameters

NameTypeRequiredNotes
name
stringyesFunction name to invoke
body
unknownnoJSON-serializable payload

Throws

ErrorCondition
NotFoundError
Function does not exist
AuthError
Invalid or expired API key
RuntimeError
Function execution threw
TimeoutError
Function exceeded 30s timeout

Examples

Basic invoke:

import { Client } from '@blueforge/client'
const bf = new Client({ apiKey: process.env.BF_API_KEY!, url: 'https://your-project.blueforge.dev' })
const { data, latencyMs } = await bf.functions.invoke('hello', { name: 'world' })
console.log(data, `(${latencyMs}ms)`)

Error handling:

try {
  await bf.functions.invoke('hello')
} catch (e) {
  if (e instanceof NotFoundError) console.error('function not found')
  if (e instanceof TimeoutError) console.error('function timed out')
}

Pitfalls

  • Cold starts — first invocation may take 1–3s longer while the runtime initialises
  • Payload limit — request body is capped at 1 MB
  • Timeout — functions hard-stop at 30 seconds regardless of response

See also

{auto-injected}

Tested against

{auto-injected}