Skip to content
This repository was archived by the owner on Nov 5, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/server/runtime/deno/AppsEngineDenoRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ export const ALLOWED_ACCESSOR_METHODS = [
>
>;

// Trying to access environment variables in Deno throws an error where in vm2 it simply returned `undefined`
// So here we define the allowed envvars to prevent the process (and the compatibility) from breaking
export const ALLOWED_ENVIRONMENT_VARIABLES = [
'NODE_EXTRA_CA_CERTS', // Accessed by the `https` node module
];

const COMMAND_PING = '_zPING';
const COMMAND_PONG = '_zPONG';

Expand Down Expand Up @@ -119,14 +125,14 @@ export class DenoRuntimeSubprocessController extends EventEmitter {
'run',
hasNetworkingPermission ? '--allow-net' : '',
`--allow-read=${appsEngineDir},${parentNodeModulesDir}`,
`--allow-env=${ALLOWED_ENVIRONMENT_VARIABLES.join(',')}`,
denoWrapperPath,
'--subprocess',
];

this.debug('Starting Deno subprocess for app with options %O', options);

this.deno = child_process.spawn(denoExePath, options, { env: null });
// console.log(this.deno);

this.setupListeners();
this.startPing();
Expand Down