fix(e2b-env-var): use isTruthy and getEnv (#1228)

This commit is contained in:
Vikhyath Mondreti
2025-09-02 20:03:43 -07:00
committed by GitHub
parent 533b4c53e0
commit b74ab46820
3 changed files with 6 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
import { createContext, Script } from 'vm'
import { type NextRequest, NextResponse } from 'next/server'
import { env, isTruthy } from '@/lib/env'
import { executeInE2B } from '@/lib/execution/e2b'
import { CodeLanguage, DEFAULT_CODE_LANGUAGE, isValidCodeLanguage } from '@/lib/execution/languages'
import { createLogger } from '@/lib/logs/console/logger'
@@ -579,7 +580,7 @@ export async function POST(req: NextRequest) {
resolvedCode = codeResolution.resolvedCode
const contextVariables = codeResolution.contextVariables
const e2bEnabled = process.env.E2B_ENABLED === 'true'
const e2bEnabled = isTruthy(env.E2B_ENABLED)
const lang = isValidCodeLanguage(language) ? language : DEFAULT_CODE_LANGUAGE
const useE2B =
e2bEnabled &&

View File

@@ -1,7 +1,7 @@
import { Info } from 'lucide-react'
import { Label, Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui'
import { Switch as UISwitch } from '@/components/ui/switch'
import { env } from '@/lib/env'
import { getEnv, isTruthy } from '@/lib/env'
import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/hooks/use-sub-block-value'
interface E2BSwitchProps {
@@ -23,7 +23,7 @@ export function E2BSwitch({
previewValue,
disabled = false,
}: E2BSwitchProps) {
const e2bEnabled = env.NEXT_PUBLIC_E2B_ENABLED === 'true'
const e2bEnabled = isTruthy(getEnv('NEXT_PUBLIC_E2B_ENABLED'))
if (!e2bEnabled) return null
const [storeValue, setStoreValue] = useSubBlockValue<boolean>(blockId, subBlockId)

View File

@@ -6,7 +6,7 @@ import { Badge } from '@/components/ui/badge'
import { Button } from '@/components/ui/button'
import { Card } from '@/components/ui/card'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import { env } from '@/lib/env'
import { getEnv, isTruthy } from '@/lib/env'
import { createLogger } from '@/lib/logs/console/logger'
import { parseCronToHumanReadable } from '@/lib/schedules/utils'
import { cn, validateName } from '@/lib/utils'
@@ -443,7 +443,7 @@ export function WorkflowBlock({ id, data }: NodeProps<WorkflowBlockProps>) {
const isTriggerMode = useWorkflowStore.getState().blocks[blockId]?.triggerMode ?? false
const effectiveAdvanced = currentWorkflow.isDiffMode ? displayAdvancedMode : isAdvancedMode
const effectiveTrigger = currentWorkflow.isDiffMode ? displayTriggerMode : isTriggerMode
const e2bClientEnabled = env.NEXT_PUBLIC_E2B_ENABLED === 'true'
const e2bClientEnabled = isTruthy(getEnv('NEXT_PUBLIC_E2B_ENABLED'))
// Filter visible blocks and those that meet their conditions
const visibleSubBlocks = subBlocks.filter((block) => {