Skip to content

Commit 9dfe399

Browse files
committed
Fix sandbox create type mismatch
1 parent 1f0b623 commit 9dfe399

File tree

4 files changed

+22
-14
lines changed

4 files changed

+22
-14
lines changed

.changeset/wise-readers-pay.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@e2b/desktop": patch
3+
---
4+
5+
Fix type mismatch for newer SDK

packages/js-sdk/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@
6060
"vitest": "^3.0.5"
6161
},
6262
"dependencies": {
63-
"e2b": "^1.0.5"
63+
"e2b": "^1.0.7"
6464
}
6565
}

packages/js-sdk/src/sandbox.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,21 @@ export class Sandbox extends SandboxBase {
9191

9292
const config = new ConnectionConfig(sandboxOpts)
9393

94-
const sandboxId = config.debug
95-
? 'debug_sandbox_id'
96-
: await this.createSandbox(
97-
template,
98-
sandboxOpts?.timeoutMs ?? this.defaultSandboxTimeoutMs,
99-
sandboxOpts
94+
let sbx
95+
if (config.debug) {
96+
sbx = new this({ sandboxId: 'debug_sandbox_id', ...config }) as InstanceType<S>
97+
} else {
98+
const sandbox = await this.createSandbox(
99+
template,
100+
sandboxOpts?.timeoutMs ?? this.defaultSandboxTimeoutMs,
101+
sandboxOpts
100102
)
103+
sbx = new this({ ...sandbox, ...config }) as InstanceType<S>
104+
}
101105

102-
const sbx = new this({ sandboxId, ...config }) as InstanceType<S>
103106

104107
if (sandboxOpts?.videoStream) {
105-
this.startVideoStream(sbx, config.apiKey!, sandboxId, sandboxOpts?.onVideoStreamStart)
108+
this.startVideoStream(sbx, config.apiKey!, sbx.sandboxId, sandboxOpts?.onVideoStreamStart)
106109
}
107110

108111
return sbx

pnpm-lock.yaml

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)