BlueForge Docs

client.functions.deploy

Deploy or update an edge function.

Signature

class Client {
  functions: {
    deploy(name: string, code: string, opts?: { trigger?: string; cronSchedule?: string }): Promise<void>
  }
}

Parameters

NameTypeRequiredNotes
name
stringyesFunction name (unique per-project)
code
stringyesJavaScript/TypeScript source code
trigger
stringnoHTTP endpoint path (e.g.
/hello
)
cronSchedule
stringnoCron expression for scheduled runs

Throws

ErrorCondition
ValidationError
Invalid function name or code
AuthError
Invalid or expired API key

Examples

HTTP-triggered function:

await bf.functions.deploy('hello', `
export default async (req) => {
  return { body: \`Hello \${req.name}!\` }
}`, { trigger: '/hello' })

Scheduled function:

await bf.functions.deploy('daily-report', `
export default async () => {
  await runReport()
}`, { cronSchedule: '0 6 * * *' })

Pitfalls

  • Code size limit — 500 KB max per function
  • Trigger conflicts — two functions cannot share the same trigger path
  • Hot redeploy — existing invocations drain before new code takes effect

See also

{auto-injected}

Tested against

{auto-injected}