CubeLoop — a Pythonic, async-native agent harness core designed for high performance, readability, and production-grade persistence.
Python agent-frameworkagent-harnessagent-runtimeagentic-aiai-agentsai-frameworkanthropicharnessharness-engineeringharness-frameworklanggraphlanggraph-alternativellmmcpopenaipi-agentpi-agent-corepythonpython-agent
fix(website): fall back to US PostHog host when env is empty string
xf gong1b9cf88a6590
diff --git a/website/docusaurus.config.ts b/website/docusaurus.config.tsindex 430bbf6..6e7ac21 100644--- a/website/docusaurus.config.ts+++ b/website/docusaurus.config.ts@@ -2,8 +2,12 @@ import type { Config } from '@docusaurus/types';import type { Options as ClassicOptions } from '@docusaurus/preset-classic';import { themes as prismThemes } from 'prism-react-renderer';-const POSTHOG_KEY = process.env.POSTHOG_KEY ?? '';-const POSTHOG_HOST = process.env.POSTHOG_HOST ?? 'https://us.i.posthog.com';+// Use `||` not `??` here: GitHub Actions expands an unset secret to "" (an+// empty string passes the nullish check, so `??` would leave api_host empty+// and PostHog falls back to the current origin — sending POST /e/ to the+// docs domain and hitting a 405 from Cloudflare Pages).+const POSTHOG_KEY = process.env.POSTHOG_KEY || '';+const POSTHOG_HOST = process.env.POSTHOG_HOST || 'https://us.i.posthog.com';const GIT_SHA = process.env.GITHUB_SHA?.slice(0, 7) ?? 'dev';const classicOptions: ClassicOptions = {diff --git a/website/src/clientModules/posthog.ts b/website/src/clientModules/posthog.tsindex f2bc9e9..2c1457b 100644--- a/website/src/clientModules/posthog.ts+++ b/website/src/clientModules/posthog.ts@@ -1,8 +1,10 @@import posthog from 'posthog-js';import siteConfig from '@generated/docusaurus.config';-const key = (siteConfig.customFields?.POSTHOG_KEY as string | undefined) ?? '';-const host = (siteConfig.customFields?.POSTHOG_HOST as string | undefined) ?? 'https://us.i.posthog.com';+// Use `||` not `??`: the build embeds POSTHOG_HOST="" when the secret is+// unset, and we need the empty string to fall back to the US endpoint.+const key = (siteConfig.customFields?.POSTHOG_KEY as string | undefined) || '';+const host = (siteConfig.customFields?.POSTHOG_HOST as string | undefined) || 'https://us.i.posthog.com';if (typeof window !== 'undefined' && key) {posthog.init(key, {