File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -370,9 +370,15 @@ export async function initializeComputeRegion(
370370
371371export function getComputeRegion ( ) : string | undefined {
372372 if ( computeRegion === notInitialized ) {
373- throw new Error ( 'Attempted to get compute region without initializing.' )
373+ // Set a default value immediately to prevent future calls from throwing error
374+ const isC9 = isCloud9 ( )
375+ const isSM = isSageMaker ( )
376+ computeRegion = isC9 || isSM ? 'unknown' : undefined
377+ // Start async initialization in the background
378+ initializeComputeRegion ( undefined , isC9 , isSM ) . catch ( ( e ) => {
379+ getLogger ( ) . error ( 'Failed to initialize compute region: %s and using a default value: %s' , e , computeRegion )
380+ } )
374381 }
375-
376382 return computeRegion
377383}
378384
You can’t perform that action at this time.
0 commit comments