process.env.FEATURE_FLAGS_URL is defined in my API routes on preview deployments but is undefined in middleware.ts.
Production is fine. The variable is set for Preview and Production in project settings.
process.env.FEATURE_FLAGS_URL is defined in my API routes on preview deployments but is undefined in middleware.ts.
Production is fine. The variable is set for Preview and Production in project settings.
Middleware runs at the edge, and edge code only sees variables that existed when it was built. If you added the variable after the last preview build, redeploy the preview — a promote does not rebuild.
Redeployed and it is there. Might be worth a hint in the dashboard when an edge bundle predates a variable change.