File tree Expand file tree Collapse file tree 4 files changed +22
-4
lines changed Expand file tree Collapse file tree 4 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @codesandbox/sdk" ,
3- "version" : " 1.1.5 " ,
3+ "version" : " 1.1.6 " ,
44 "description" : " The CodeSandbox SDK" ,
55 "author" : " CodeSandbox" ,
66 "license" : " MIT" ,
Original file line number Diff line number Diff line change 99} from "./api-clients/client" ;
1010import { Sandbox } from "./Sandbox" ;
1111import {
12- getDefaultTemplateId ,
12+ getDefaultTemplateTag ,
1313 getStartOptions ,
1414 getStartResponse ,
1515 handleResponse ,
@@ -62,7 +62,7 @@ export async function startVm(
6262 */
6363export class Sandboxes {
6464 get defaultTemplateId ( ) {
65- return getDefaultTemplateId ( this . apiClient ) ;
65+ return getDefaultTemplateTag ( this . apiClient ) ;
6666 }
6767
6868 constructor ( private apiClient : Client ) { }
Original file line number Diff line number Diff line change @@ -149,6 +149,16 @@ export const buildCommand: yargs.CommandModule<
149149 updateSpinnerMessage ( index , "Starting sandbox..." , sandboxId )
150150 ) ;
151151
152+ // This is a hack, we need to tell the global scheduler that the VM is running
153+ // in a different cluster than the one it'd like to default to.
154+ const baseUrl = apiClient
155+ . getConfig ( )
156+ . baseUrl ?. replace ( "api" , "global-scheduler" ) ;
157+
158+ await fetch (
159+ `${ baseUrl } /api/v1/cluster/${ sandboxId } ?preferredManager=${ cluster } `
160+ ) . then ( ( res ) => res . json ( ) ) ;
161+
152162 const startResponse = await startVm ( clusterApiClient , sandboxId , {
153163 vmTier : VMTier . fromName ( "Micro" ) ,
154164 } ) ;
Original file line number Diff line number Diff line change @@ -51,12 +51,20 @@ export function getBaseUrl(token: string) {
5151 return "https://api.together.ai/csb/sdk" ;
5252}
5353
54+ export function getDefaultTemplateTag ( apiClient : Client ) : string {
55+ if ( apiClient . getConfig ( ) . baseUrl ?. includes ( "codesandbox.stream" ) ) {
56+ return "7ngcrf" ;
57+ }
58+
59+ return "pt_LAVK5kxK8XciqgV2642xRk" ;
60+ }
61+
5462export function getDefaultTemplateId ( apiClient : Client ) : string {
5563 if ( apiClient . getConfig ( ) . baseUrl ?. includes ( "codesandbox.stream" ) ) {
5664 return "7ngcrf" ;
5765 }
5866
59- return "pt_UAYyadeQTA9jw8bXqzgy6v " ;
67+ return "pcz35m " ;
6068}
6169
6270export function handleResponse < D , E > (
You can’t perform that action at this time.
0 commit comments