From b7ccb9bbac88a656a8b56536410a5881ee86d8cb Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Fri, 13 Feb 2026 00:33:40 +0000 Subject: [PATCH] fix: fix hub schedule not set at on-boarding --- backend/tests/workspace_dependencies.rs | 8 ----- .../src/workspace_dependencies.rs | 2 -- .../(user)/instance_settings/+page.svelte | 33 ++++++++++++------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/backend/tests/workspace_dependencies.rs b/backend/tests/workspace_dependencies.rs index d8e705d0c3..4f1023d54d 100644 --- a/backend/tests/workspace_dependencies.rs +++ b/backend/tests/workspace_dependencies.rs @@ -121,14 +121,6 @@ mod workspace_dependencies { ); // Verify built-in fixtures exist - // Check that the setup_app exists - let app_exists = - sqlx::query_scalar!("SELECT EXISTS(SELECT 1 FROM app WHERE path = 'g/all/setup_app')") - .fetch_one(db) - .await - .unwrap(); - assert!(app_exists.unwrap(), "Expected g/all/setup_app to exist"); - // Check that hub_sync script exists and is a Bun script let hub_sync_lang = sqlx::query_scalar!( r#"SELECT language AS "language: ScriptLang" FROM script WHERE path = 'u/admin/hub_sync'"# diff --git a/backend/windmill-common/src/workspace_dependencies.rs b/backend/windmill-common/src/workspace_dependencies.rs index 68f20967f4..6920e84a06 100644 --- a/backend/windmill-common/src/workspace_dependencies.rs +++ b/backend/windmill-common/src/workspace_dependencies.rs @@ -18,8 +18,6 @@ use phf::phf_set; pub static BLACKLIST: phf::Set<&'static str> = phf_set! { "u/admin/hub_sync", - "g/all/setup_app/app", - "g/all/setup_app" }; lazy_static::lazy_static! { diff --git a/frontend/src/routes/(root)/(logged)/user/(user)/instance_settings/+page.svelte b/frontend/src/routes/(root)/(logged)/user/(user)/instance_settings/+page.svelte index b935ca8f80..c90963b1a3 100644 --- a/frontend/src/routes/(root)/(logged)/user/(user)/instance_settings/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/user/(user)/instance_settings/+page.svelte @@ -15,7 +15,7 @@ import Breadcrumb from '$lib/components/common/breadcrumb/Breadcrumb.svelte' import { ChevronRight, ArrowLeft } from 'lucide-svelte' import { superadmin } from '$lib/stores' - import { UserService, ScheduleService, JobService } from '$lib/gen' + import { UserService, JobService } from '$lib/gen' import { sendUserToast } from '$lib/toast' import TextInput from '$lib/components/text_input/TextInput.svelte' import Toggle from '$lib/components/Toggle.svelte' @@ -189,18 +189,27 @@ if (enableHubSync) { try { - await ScheduleService.createSchedule({ - workspace: 'admins', - requestBody: { - path: 'g/all/hub_sync', - schedule: '0 0 0 * * *', - script_path: 'u/admin/hub_sync', - is_flow: false, - args: {}, - enabled: true, - timezone: 'Etc/UTC' + // Use direct fetch with token as query param to avoid the old session cookie + // overriding the Authorization header + const resp = await fetch( + `/api/w/admins/schedules/create?token=${encodeURIComponent(token)}`, + { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + path: 'g/all/hub_sync', + schedule: '0 0 0 * * *', + script_path: 'u/admin/hub_sync', + is_flow: false, + args: {}, + enabled: true, + timezone: 'Etc/UTC' + }) } - }) + ) + if (!resp.ok) { + console.warn('Schedule creation failed:', await resp.text()) + } } catch (e: any) { console.warn('Schedule creation failed:', e?.body ?? e) }