Skip to content

Commit 9b4909b

Browse files
committed
fix(toolkit): handle isCn when region is not initialized to fix extension activation failure
1 parent 74ac902 commit 9b4909b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/core/src/shared/extensionUtilities.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,13 @@ export function isSageMaker(appName: 'SMAI' | 'SMUS' = 'SMAI'): boolean {
194194
}
195195

196196
export function isCn(): boolean {
197-
return getComputeRegion()?.startsWith('cn') ?? false
197+
try {
198+
return getComputeRegion()?.startsWith('cn') ?? false
199+
} catch (e) {
200+
// If compute region isn't initialized yet, assume we're not in a CN region
201+
getLogger().debug('isCn called before compute region initialized, defaulting to false')
202+
return false
203+
}
198204
}
199205

200206
/**

0 commit comments

Comments
 (0)