Skip to content

Commit a52d7fd

Browse files
committed
fix: import randomUUID from node:crypto for non-secure contexts
crypto.randomUUID() is only available in secure contexts (HTTPS). When accessing self-hosted sim over HTTP (e.g., http://192.168.x.x), the global crypto API doesn't expose randomUUID, causing white screen. Fix: import { randomUUID } from node:crypto instead of relying on the global crypto.randomUUID(). Affected files: - tools/langsmith/utils.ts: runId fallback - executor/handlers/workflow/workflow-handler.ts: instanceId generation Fixes #3393
1 parent 2cf59c8 commit a52d7fd

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

apps/sim/executor/handlers/workflow/workflow-handler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { randomUUID } from 'node:crypto'
12
import { createLogger } from '@sim/logger'
23
import { buildNextCallChain, validateCallChain } from '@/lib/execution/call-chain'
34
import { snapshotService } from '@/lib/logs/execution/snapshot/service'
@@ -81,7 +82,7 @@ export class WorkflowBlockHandler implements BlockHandler {
8182

8283
// Unique ID per invocation — used to correlate child block events with this specific
8384
// workflow block execution, preventing cross-iteration child mixing in loop contexts.
84-
const instanceId = crypto.randomUUID()
85+
const instanceId = randomUUID()
8586

8687
const childCallChain = buildNextCallChain(ctx.callChain || [], workflowId)
8788
const depthError = validateCallChain(childCallChain)

apps/sim/tools/langsmith/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { randomUUID } from 'node:crypto'
12
import type { LangsmithRunPayload } from '@/tools/langsmith/types'
23

34
interface NormalizedRunPayload {
@@ -20,7 +21,7 @@ const toCompactTimestamp = (startTime?: string): string => {
2021
}
2122

2223
export const normalizeLangsmithRunPayload = (run: LangsmithRunPayload): NormalizedRunPayload => {
23-
const runId = run.id ?? crypto.randomUUID()
24+
const runId = run.id ?? randomUUID()
2425
const traceId = run.trace_id ?? runId
2526
const startTime = run.start_time ?? new Date().toISOString()
2627
const dottedOrder = run.dotted_order ?? `${toCompactTimestamp(startTime)}Z${runId}`

0 commit comments

Comments
 (0)