Functions

Functions move through draft and deployed versions. Runtime dispatch resolves deployed version metadata and executes in Cloudflare workers.

Step-by-Step Guide

1.Logos

Give a function (or your workspace) a logo from its settings page. Logos show up in the dashboard and on marketplace listings.

  • Formats: PNG, JPEG, WebP, or SVG — validated by content, not just file extension.
  • Up to 2 MB. SVGs are checked for active content (scripts, event handlers, external references) and rejected if unsafe.

2.Deleting a function

Delete from Settings after typing the function name to confirm. Deletion is permanent — there is no undo.

  • Removes all versions, drafts, triggers, secrets, execution history, assets, and marketplace data (stars, comments, forks keep their lineage records on the source side).
  • Deployed workers and cached routes are cleaned up best-effort in the background.

SDK API Reference

Use @hostfunc/sdk as default import surface. Use @hostfunc/fn only for legacy compatibility.

fn.executeFunction

await fn.executeFunction(slug: string, input?: Record<string, unknown>): Promise<unknown>

Invokes another function through runtime dispatch and records parent-child execution linkage.

Arguments

NameTypeRequiredDescription
slugstring (orgSlug/fnSlug)YesTarget function identifier.
inputRecord<string, unknown>NoJSON payload forwarded to downstream main() input.

Returns

Parsed JSON returned by the downstream function.

Throws

  • FN_NOT_FOUND if slug is malformed or function is unavailable.
  • FN_CALL_DEPTH when call-depth protection triggers.
  • FN_THREW for non-2xx downstream responses.

Notes

  • Prefer stable slugs from config, not raw user input.
  • Pass IDs/references instead of large blobs for better latency.

secret.get

await secret.get(key: string): Promise<string | null>

Fetches an optional secret configured for the current function.

Arguments

NameTypeRequiredDescription
keystringYesSecret key name configured in function settings.

Returns

Secret value as string, or null when not set.

Throws

  • INFRA_EXECUTE_FAILED when secret service cannot be reached/authenticated.

secret.getRequired

await secret.getRequired(key: string): Promise<string>

Fetches a required secret and throws if the key is missing.

Arguments

NameTypeRequiredDescription
keystringYesSecret key name configured in function settings.

Returns

Secret value as string.

Throws

  • MISSING_SECRET (wrapped in SDK error detail) when key is missing.
  • INFRA_EXECUTE_FAILED when control-plane secret service fails.

Notes

  • Use for credentials required on every invocation path.

SDK Code Examples

Composition with required secret

Default pattern for function-to-function workflows.

typescript
import fn, { secret } from "@hostfunc/sdk";export async function main(input: { customerId: string }) {  const apiKey = await secret.getRequired("CLAUDE_API_KEY");  const report = await fn.executeFunction("my-org/generate-report", {    customerId: input.customerId,    apiKey,  });  return await fn.executeFunction("my-org/post-to-slack", {    report,    channel: "#alerts",  });}

Best Practices

  • Keep functions small and composable.
  • Treat missing required secrets as configuration failures.
  • Design downstream calls to be idempotent for retries.
  • Use explicit payload schemas to avoid shape drift.

Related Documentation