Runtime

V8 isolate runtime — available Web APIs, globals, and limitations.

Runtime

Cluster functions run in V8 isolates — lightweight sandboxes using the same JavaScript engine as Chrome. Each function gets its own isolate with a full set of Web APIs.

Available APIs

HTTP

APIDescription
RequestStandard Request object
ResponseStandard Response with Response.json()
HeadersStandard Headers
fetch()Make HTTP requests from your handler
URLURL parsing and construction
URLSearchParamsQuery string manipulation
URLPatternPattern matching for URLs
FormDataMultipart form data

Encoding

APIDescription
TextEncoderEncode strings to UTF-8 Uint8Array
TextDecoderDecode Uint8Array to strings
atob()Decode base64 to string
btoa()Encode string to base64

Crypto

APIDescription
crypto.subtle.digest()SHA-1, SHA-256, SHA-384, SHA-512
crypto.subtle.sign() / verify()HMAC, RSA-PSS, RSASSA-PKCS1-v1_5, ECDSA
crypto.subtle.encrypt() / decrypt()AES-CBC, AES-CTR, AES-GCM, RSA-OAEP
crypto.subtle.generateKey()Generate key pairs and symmetric keys
crypto.subtle.importKey() / exportKey()Import/export keys in various formats
crypto.getRandomValues()Cryptographically secure random bytes
crypto.randomUUID()Generate a random UUID v4

Streams

APIDescription
ReadableStreamRead data incrementally
WritableStreamWrite data incrementally
TransformStreamTransform data between streams
CompressionStreamgzip/deflate compression
DecompressionStreamgzip/deflate decompression

Globals

APIDescription
console.log() / error() / warn()Logging (sent to OpenTelemetry)
setTimeout() / setInterval()Timers
clearTimeout() / clearInterval()Cancel timers
AbortController / AbortSignalCancel async operations
BlobBinary data container
FileFile-like object (extends Blob)
Event / EventTargetEvent system
navigator.userAgentReturns "Cluster"
process.envEnvironment variables
queueMicrotask()Queue a microtask
structuredClone()Deep clone objects

V8 Version

The runtime uses V8 146.9.0 with:

  • Full ES2024 support
  • ICU 77 for internationalization (Intl.* APIs)
  • WebAssembly support

Limitations

  • No Node.js APIs — no fs, path, os, child_process, net, http, Buffer
  • No require() — use ES module import/export (esbuild bundles everything)
  • No eval() by default — enable with --allow-code-generation in dev, not available in production
  • 30-second timeout — requests that exceed 30 seconds are terminated
  • No persistent state — isolates may be recycled between requests. Use external services for state

Example: Crypto

export async function handler(request: Request): Promise<Response> {
  const body = await request.text();
  const encoded = new TextEncoder().encode(body);
  const hash = await crypto.subtle.digest("SHA-256", encoded);
  const hex = [...new Uint8Array(hash)]
    .map(b => b.toString(16).padStart(2, "0"))
    .join("");
  return Response.json({ sha256: hex });
}

Example: Streaming

export function handler(request: Request): Response {
  const stream = new ReadableStream({
    start(controller) {
      controller.enqueue(new TextEncoder().encode("Hello "));
      controller.enqueue(new TextEncoder().encode("World!"));
      controller.close();
    },
  });
  return new Response(stream);
}

On this page