fix: skip analytics capture calls if workspaceId is undefined

This commit is contained in:
Ting-Wai To 2025-08-05 14:55:31 -07:00
parent 3bbf241720
commit 45214eb743
2 changed files with 8 additions and 1 deletions

View file

@ -358,6 +358,9 @@ export default async function doLoadConfig(options: {
};
if (newConfig.analytics) {
// FIXME before re-enabling TeamAnalytics.setup() populate workspaceId in
// controlPlaneProxyInfo to prevent /proxy/analytics/undefined/capture calls
// where undefined is :workspaceId
// await TeamAnalytics.setup(
// newConfig.analytics,
// uniqueId,

View file

@ -20,8 +20,12 @@ export default class ContinueProxyAnalyticsProvider
event: string,
properties: { [key: string]: any },
): Promise<void> {
if (!this.controlPlaneProxyInfo?.workspaceId) {
return;
}
const url = new URL(
`proxy/analytics/${this.controlPlaneProxyInfo?.workspaceId}/capture`,
`proxy/analytics/${this.controlPlaneProxyInfo.workspaceId}/capture`,
this.controlPlaneProxyInfo?.controlPlaneProxyUrl,
).toString();
void fetch(url, {