Skip to content

Commit 8be639d

Browse files
authored
Merge branch 'dev' into external-db-sync
2 parents 98d451d + 45df751 commit 8be639d

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

apps/backend/.env.development

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ STACK_ENABLE_HARDCODED_PASSKEY_CHALLENGE_FOR_TESTING=yes
5353
STACK_INTEGRATION_CLIENTS_CONFIG='[{"client_id": "neon-local", "client_secret": "neon-local-secret", "id_token_signed_response_alg": "ES256", "redirect_uris": ["http://localhost:30000/api/v2/identity/authorize", "http://localhost:30000/api/v2/auth/authorize"]}, {"client_id": "custom-local", "client_secret": "custom-local-secret", "id_token_signed_response_alg": "ES256", "redirect_uris": ["http://localhost:30000/api/v2/identity/authorize", "http://localhost:30000/api/v2/auth/authorize"]}]'
5454
CRON_SECRET=mock_cron_secret
5555
STACK_FREESTYLE_API_KEY=mock_stack_freestyle_key
56+
STACK_VERCEL_SANDBOX_TOKEN=vercel_sandbox_disabled_for_local_development
5657
STACK_OPENAI_API_KEY=mock_openai_api_key
5758
STACK_STRIPE_SECRET_KEY=sk_test_mockstripekey
5859
STACK_STRIPE_WEBHOOK_SECRET=mock_stripe_webhook_secret

apps/backend/src/lib/js-execution.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ function createVercelSandboxEngine(): JsEngine {
5757
return {
5858
name: 'vercel-sandbox',
5959
execute: async (code: string, options: ExecuteJavascriptOptions): Promise<ExecuteResult> => {
60-
const teamId = getEnvVariable("STACK_VERCEL_SANDBOX_TEAM_ID", "");
61-
const projectId = getEnvVariable("STACK_VERCEL_SANDBOX_PROJECT_ID", "");
62-
const token = getEnvVariable("STACK_VERCEL_SANDBOX_TOKEN", "");
60+
const teamId = getEnvVariable("STACK_VERCEL_SANDBOX_TEAM_ID");
61+
const projectId = getEnvVariable("STACK_VERCEL_SANDBOX_PROJECT_ID");
62+
const token = getEnvVariable("STACK_VERCEL_SANDBOX_TOKEN");
6363

6464
const sandbox = await Sandbox.create({
6565
resources: { vcpus: 2 },
@@ -139,18 +139,18 @@ export async function executeJavascript(code: string, options: ExecuteJavascript
139139
}
140140
}, async () => {
141141

142-
if (getEnvVariable("STACK_VERCEL_SANDBOX_TOKEN","") != "") {
143-
if (!getNodeEnvironment().includes("prod")) {
144-
throw new StackAssertionError("STACK_VERCEL_SANDBOX_TOKEN is set in non-production environment. We do not use Vercel Sandbox in non-production environments.");
145-
}
146-
142+
if (getEnvVariable("STACK_VERCEL_SANDBOX_TOKEN") != "vercel_sandbox_disabled_for_local_development") {
147143
const shouldSanityTest = Math.random() < 0.05;
148144
if (shouldSanityTest) {
149145
runAsynchronouslyAndWaitUntil(runSanityTest(code, options));
150146
}
151147

152148
return await runWithFallback(code, options);
153149
} else {
150+
if (getNodeEnvironment().includes("prod")) {
151+
throw new StackAssertionError("STACK_VERCEL_SANDBOX_TOKEN is set to the disabled sentinel value in production. Please configure a real Vercel Sandbox token.");
152+
}
153+
154154
return await runWithoutFallback(code, options);
155155
}
156156
});

0 commit comments

Comments
 (0)