diff --git a/packages/sandbox/src/sandbox.ts b/packages/sandbox/src/sandbox.ts index 0a5cb588..268f4dd3 100644 --- a/packages/sandbox/src/sandbox.ts +++ b/packages/sandbox/src/sandbox.ts @@ -286,7 +286,7 @@ export class Sandbox extends Container implements ISandbox { if (this.defaultSession) { // Set environment variables by executing export commands in the existing session for (const [key, value] of Object.entries(envVars)) { - const escapedValue = value.replace(/'/g, "'\\''"); + const escapedValue = value?.replace(/'/g, "'\\''"); const exportCommand = `export ${key}='${escapedValue}'`; const result = await this.client.commands.execute(