fix: replace crypto.randomUUID with generateRandomString for HTTP compatibility (#5849)

Replace crypto.randomUUID() with generateRandomString() in triggers.svelte.ts 
to fix schedule trigger creation on HTTP connections. The crypto.randomUUID() 
API requires a secure context (HTTPS), which breaks functionality for users 
connecting to Windmill over HTTP in internal networks.

Fixes #5847

Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: rubenfiszel <rubenfiszel@users.noreply.github.com>
This commit is contained in:
claude[bot]
2025-06-01 19:44:41 +02:00
committed by GitHub
parent 52ad66f530
commit be6cbe7839
@@ -20,7 +20,7 @@ import type { Writable } from 'svelte/store'
import type { TriggerType } from './utils'
import type { UserExt } from '$lib/stores'
import type { ScheduleTrigger } from '../triggers'
import { canWrite, formatCron } from '$lib/utils'
import { canWrite, formatCron, generateRandomString } from '$lib/utils'
export class Triggers {
#triggers = $state<Trigger[]>([])
@@ -94,7 +94,7 @@ export class Triggers {
const primaryScheduleExists = this.#triggers.some((t) => t.type === 'schedule' && t.isPrimary)
// Create the new draft trigger
const draftId = crypto.randomUUID()
const draftId = generateRandomString()
const isPrimary = type === 'schedule' && !primaryScheduleExists
const newTrigger = {
id: draftId,