Skip to content

Commit 10b0b1d

Browse files
Merge pull request #111 from codesandbox/quick-fix
fix: Quick fix
2 parents 765ca90 + e7bb559 commit 10b0b1d

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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",

src/Sandboxes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from "./api-clients/client";
1010
import { Sandbox } from "./Sandbox";
1111
import {
12-
getDefaultTemplateId,
12+
getDefaultTemplateTag,
1313
getStartOptions,
1414
getStartResponse,
1515
handleResponse,
@@ -62,7 +62,7 @@ export async function startVm(
6262
*/
6363
export class Sandboxes {
6464
get defaultTemplateId() {
65-
return getDefaultTemplateId(this.apiClient);
65+
return getDefaultTemplateTag(this.apiClient);
6666
}
6767

6868
constructor(private apiClient: Client) {}

src/bin/commands/build.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff 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
});

src/utils/api.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff 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+
5462
export 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

6270
export function handleResponse<D, E>(

0 commit comments

Comments
 (0)