diff --git a/src/components/live/queries.ts b/src/components/live/queries.ts index 4db78056ad..f83a493465 100644 --- a/src/components/live/queries.ts +++ b/src/components/live/queries.ts @@ -31,7 +31,13 @@ export function useLiveLinkMetaQuery(url: string | null) { if (!url) return undefined if (allowedDomains.length === 0) { - throw new Error(_(msg`You are not allowed to go live`)) + const error = _(msg`You are not allowed to go live`) + logger.metric( + 'live:linkValidation:error', + {error, url}, + {statsig: true}, + ) + throw new Error(error) } const urlp = new URL(url) @@ -41,11 +47,21 @@ export function useLiveLinkMetaQuery(url: string | null) { domain.includes('twitch'), ) if (isTwitchAttempt && !urlp.hostname.includes('twitch')) { - throw new Error( - _(msg`Only Twitch links are supported during the beta`), + const error = _(msg`Only Twitch links are supported during the beta`) + logger.metric( + 'live:linkValidation:error', + {error, url}, + {statsig: true}, ) + throw new Error(error) } - throw new Error(_(msg`${urlp.hostname} is not a valid URL`)) + const error = _(msg`${urlp.hostname} is not a valid URL`) + logger.metric( + 'live:linkValidation:error', + {error, url}, + {statsig: true}, + ) + throw new Error(error) } return await getLinkMeta(agent, url) diff --git a/src/logger/metrics.ts b/src/logger/metrics.ts index 8243b04028..14dbb246a7 100644 --- a/src/logger/metrics.ts +++ b/src/logger/metrics.ts @@ -556,6 +556,7 @@ export type MetricEvents = { 'live:card:openProfile': {subject: string} 'live:view:profile': {subject: string} 'live:view:post': {subject: string; feed?: string} + 'live:linkValidation:error': {error: string; url?: string} 'share:open': {context: 'feed' | 'thread'} 'share:press:copyLink': {} diff --git a/src/state/service-config.tsx b/src/state/service-config.tsx index 83af92f963..f016b1156a 100644 --- a/src/state/service-config.tsx +++ b/src/state/service-config.tsx @@ -95,7 +95,7 @@ export function useLiveNowConfig() { export function useCanGoLive(did?: string) { const gate = useGate() - const isInBeta = __DEV__ ? true : gate('live_now_beta') + const isInBeta = gate('live_now_beta') if (!isInBeta || !did) { return false @@ -112,7 +112,7 @@ export function useCanGoLive(did?: string) { export function useAllowedLiveDomains(did?: string): string[] { const config = useLiveNowConfig() const gate = useGate() - const isInBeta = __DEV__ ? true : gate('live_now_beta') + const isInBeta = gate('live_now_beta') if (!isInBeta || !did) { return []