diff --git a/apps/sim/app/_shell/providers/posthog-provider.tsx b/apps/sim/app/_shell/providers/posthog-provider.tsx index b127ba6c488..368bb3fc913 100644 --- a/apps/sim/app/_shell/providers/posthog-provider.tsx +++ b/apps/sim/app/_shell/providers/posthog-provider.tsx @@ -3,7 +3,7 @@ import { useEffect, useRef, useState } from 'react' import { createLogger } from '@sim/logger' import type { PostHog } from 'posthog-js' -import { getEnv, isTruthy } from '@/lib/core/config/env' +import { getEnv, isTruthy, publicEnvMissingAtModuleInit } from '@/lib/core/config/env' const logger = createLogger('PostHogProvider') @@ -49,6 +49,9 @@ export function PostHogProvider({ children }: { children: React.ReactNode }) { persistence: 'localStorage+cookie', }) } + if (publicEnvMissingAtModuleInit) { + posthog.capture('runtime_env_missing_at_module_init') + } clientRef.current = posthog setProvider(() => PHProvider) }) diff --git a/apps/sim/app/_shell/public-env-script.test.tsx b/apps/sim/app/_shell/public-env-script.test.tsx index 6bef6d894c9..7eb6aadf3ec 100644 --- a/apps/sim/app/_shell/public-env-script.test.tsx +++ b/apps/sim/app/_shell/public-env-script.test.tsx @@ -1,30 +1,29 @@ /** * @vitest-environment node */ -import { EnvScript } from 'next-runtime-env' +import { renderToStaticMarkup } from 'react-dom/server' import { describe, expect, it } from 'vitest' import { PublicEnvScript } from '@/app/_shell/public-env-script' /** - * Guards the loading strategy, not the markup. A plain `