Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(app): guard country-flag-emoji polyfill against getImageData crash (#62972)

posthog[bot]c3c007b4ecc8
diff --git a/frontend/src/exporter/index.tsx b/frontend/src/exporter/index.tsx
index 2fcf6458d735..2e5759c44577 100644
--- a/frontend/src/exporter/index.tsx
+++ b/frontend/src/exporter/index.tsx
@@ -67,7 +67,14 @@ initKea({ replaceInitialPathInWindow: false })
//
// NOTE: The first argument is the name of the polyfill to use. This is used to set the font family in our CSS.
// Make sure to update the font family in the CSS if you change this.
-polyfillCountryFlagEmojis('Emoji Flags Polyfill')
+//
+// The polyfill runs canvas-based feature detection (getImageData) which can throw on some browser
+// states (e.g. Safari/macOS). It's purely cosmetic and best-effort, so swallow any failure.
+try {
+ polyfillCountryFlagEmojis('Emoji Flags Polyfill')
+} catch (error) {
+ console.warn('[exporter] Country flag emoji polyfill detection failed:', error)
+}
function renderApp(): void {
const root = document.getElementById('root')
diff --git a/frontend/src/index.tsx b/frontend/src/index.tsx
index e94e5767f620..2b1ffc733cbb 100644
--- a/frontend/src/index.tsx
+++ b/frontend/src/index.tsx
@@ -37,7 +37,14 @@ idle(() => {
//
// NOTE: The first argument is the name of the polyfill to use. This is used to set the font family in our CSS.
// Make sure to update the font family in the CSS if you change this.
-polyfillCountryFlagEmojis('Emoji Flags Polyfill')
+//
+// The polyfill runs canvas-based feature detection (getImageData) which can throw on some browser
+// states (e.g. Safari/macOS). It's purely cosmetic and best-effort, so swallow any failure.
+try {
+ polyfillCountryFlagEmojis('Emoji Flags Polyfill')
+} catch (error) {
+ console.warn('[index] Country flag emoji polyfill detection failed:', error)
+}
// Expose `window.getReduxState()` to make snapshots to storybook easy
if (typeof window !== 'undefined') {