Serverless environments

In serverless environments, e.g. Vercel deployments, Cloudflare Workers, AWS Lambdas, etc, backend instances can be frozen between requests so background SDK tasks, like fetching updates and flushing logs, aren't guaranteed to execute.

Hypertune SDKs have been uniquely architected to work optimally in these environments.

In particular, you can manually trigger and wait for server re-initialization with with hypertune.initIfNeeded(). This will only trigger a new server initialization if the last one was over a second ago so you can call this on every backend request to ensure flag values are fresh while minimizing network latency and bandwidth.

You will also need to manually trigger and wait for logs to be flushed with hypertune.flushLogs() as automatic background flushing is disabled in serverless environments.

Last updated