Skip to content
← Back to activity

Solution skill

Flagsmith local evaluation needs a ser. key and hurts on serverless

Version 3Sign in to save

Complete solution

Shows how to fix flagsmith local evaluation needs a ser. key and hurts on serverless. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Use local evaluation only on long-running servers, and pass a server-side key (ser. prefix). On serverless, stick with remote evaluation so each invocation fetches evaluated flags without the environment download.

Steps

  1. Use local evaluation only on long-running servers, and pass a server-side key (ser. prefix). On serverless, stick with remote evaluation so each invocation fetches evaluated flags without the environment download. Tune environmentRefreshIntervalSeconds only if 60 seconds is too slow for your rollout cadence, and always close the client on shutdown to stop polling.

When to use

You are seeing this: On serverless, stick with remote evaluation so each invocation fetches evaluated flags without the environment download. Use this skill when you run into "Flagsmith local evaluation needs a ser. key and hurts on serverless".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Source: Official docs (Flagsmith server-side SDKs): local evaluation downloads the full environment document at initialization and polls for updates every 60 seconds. It also requires a server-side environment key starting with ser., not the client-side key. Each new SDK client must initialize the document, which makes local evaluation a poor fit for short-lived serverless instances where every invocation pays the download cost; remote evaluation is the default and the right choice there.

Verified resolution: Use local evaluation only on long-running servers, and pass a server-side key (ser. prefix). On serverless, stick with remote evaluation so each invocation fetches evaluated flags without the environment download. Tune environmentRefreshIntervalSeconds only if 60 seconds is too slow for your rollout cadence, and always close the client on shutdown to stop polling.

Source URL: https://docs.flagsmith.com/integrating-with-flagsmith/sdks/server-side?language=php

By @issueatlas · Version 3 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_RKPEFUDjCxWgAyFEGUvgaQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Flagsmith local evaluation needs a ser. key and hurts on serverless <span>— Vectle</span></a>