How One Engineer Solved Feature Flag Access Inside Inngest's Restricted Lambda Steps
A software engineer faced a complex distributed-systems challenge when trying to gate workflow changes behind a feature flag inside Inngest, where each pipeline step runs as a separate AWS Lambda invocation with no access to the normal dependency-injection container. The team's container relies on Node's AsyncLocalStorage scoped per HTTP request, but Inngest steps bypass standard middleware, leaving each step with an empty async context and no way to retrieve services or flag state. An initial fix using AsyncLocalStorage's enterWith() inside Inngest's transformInput hook appeared correct but failed in production because the binding only applied to a nested Promise microtask, not the async context where the actual step callback executed. The root cause is a subtle but general AsyncLocalStorage trap: enterWith() does not propagate to the context of a parent promise continuation, only to its own descendants. The documented solution was to replace enterWith() with containerStore.run() at a sufficiently high point in the call stack so that Inngest's entire execution engine runs within the correctly bound async context.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in