@forge/tunnel

7.1.2-next.37.1.2-next.3-experimental-e9e08bb
out/sandbox/node-sandbox.js
~out/sandbox/node-sandbox.jsModified
+11−1
Index: package/out/sandbox/node-sandbox.js
===================================================================
--- package/out/sandbox/node-sandbox.js
+++ package/out/sandbox/node-sandbox.js
@@ -8,8 +8,17 @@
 const crypto_1 = require("crypto");
 const bundler_1 = require("@forge/bundler");
 const runtime_1 = require("@forge/runtime");
 const RUNNER = path_1.default.join(__dirname, '..', '..', 'out', 'sandbox', 'sandbox-runner.js');
+const LOCAL_STORAGE_ENVIRONMENT_KEYS = [
+    'FORGE_LOCAL_STORAGE',
+    'FORGE_LOCAL_KVS_URL',
+    'FORGE_LOCAL_SQL_URL',
+    'FORGE_LOCAL_STORAGE_APP_ID',
+    'FORGE_LOCAL_STORAGE_ENVIRONMENT_ID',
+    'FORGE_LOCAL_STORAGE_INSTALLATION_ID'
+];
+const localStorageEnvironment = () => Object.fromEntries(LOCAL_STORAGE_ENVIRONMENT_KEYS.flatMap((key) => (process.env[key] === undefined ? [] : [[key, process.env[key]]])));
 class NodeSandbox {
     name;
     process;
     callbacks;
@@ -22,13 +31,14 @@
         const handlerEnv = '__forge__.main';
         this.process = (0, child_process_1.fork)(RUNNER, [fileName, handlerName], {
             stdio: ['ignore', 'pipe', 2, 'ipc'],
             env: {
+                ...localStorageEnvironment(),
                 _HANDLER: handlerEnv,
                 FORGE_EFS_RUNTIME_PATH: appPath,
                 FORGE_CUSTOM_WRAPPER_FILE_NAME: '__forge_wrapper__.cjs'
             },
-            execArgv: debugPort ? [`--inspect=${debugHost}:${debugPort}`] : undefined
+            execArgv: debugPort ? [`--inspect=${debugHost}:${debugPort}`] : []
         });
         readline_1.default.createInterface(this.process.stdout).on('line', (line) => {
             const message = JSON.parse(line);
             this.handleOutput(message);