Skip to content

Pre-GA Design Partner and Early Access only. Request access

Helix Docs
v0.90.0 CLI · SDK

getContext returns PlatformContext

getContext() now returns the canonical execution context, so request-specific fields are optional and need a presence check. Handler parameters are unaffected.

npm install @trayai/helix-cli@0.90.0 @trayai/helix-sdk@0.90.0
View as Markdown

What matters in this release

Changed

getContext() returns PlatformContext instead of TrayContext

This is the change most likely to need an edit in your code. The members present in every execution are unchanged: http, db(), kv(), files(), log, config, state, executionId, deploymentId, and traceId. The request-specific ones are now optional, so check the field you read, for example const ctx = getContext(); if (ctx.method !== undefined) { ctx.method; }. That covers input, method, path, headers, request, status(), error(), userId, and identity. Handler parameters are untouched: a defineFunction handler still receives the exact TrayContext. Scheduled functions, added in 0.93.0, are the first trigger to depend on this: they run without a request, so the request-derived fields are absent.

Read the docs →

Everything else that changed

Changed

  • runWithContext mocks mirror production for optional fieldsReading an unset optional PlatformContext field in a mock returns undefined, so presence-guard code is testable. Unset always-present fields still throw the descriptive error. Docs →
  • Clearer error when getContext() is called outside an execution Docs →

All releases

Loading search…

Jump to a section

tab to move · esc to close