diff --git a/backend/src/monitor.rs b/backend/src/monitor.rs index 2b9cd80ec4..ff95e9b1b3 100644 --- a/backend/src/monitor.rs +++ b/backend/src/monitor.rs @@ -638,6 +638,7 @@ async fn handle_zombie_jobs base_internal_url: base_internal_url.to_string(), token, workspace: job.workspace_id.to_string(), + force_client: None, }; let last_ping = job.last_ping.clone(); diff --git a/backend/windmill-worker/src/js_eval.rs b/backend/windmill-worker/src/js_eval.rs index e5217e50fe..1535bbb7f4 100644 --- a/backend/windmill-worker/src/js_eval.rs +++ b/backend/windmill-worker/src/js_eval.rs @@ -173,7 +173,14 @@ pub async fn eval_timeout( { let op_state = js_runtime.op_state(); let mut op_state = op_state.borrow_mut(); - op_state.put(OptAuthedClient(authed_client.clone())); + let mut client = authed_client.clone(); + if let Some(client) = client.as_mut() { + client.force_client = Some(reqwest::ClientBuilder::new() + .user_agent("windmill/beta") + .danger_accept_invalid_certs(std::env::var("ACCEPT_INVALID_CERTS").is_ok()) + .build().unwrap()); + } + op_state.put(OptAuthedClient(client)); op_state.put(TransformContext { flow_input: if has_flow_input { flow_input } else { None }, envs: transform_context diff --git a/backend/windmill-worker/src/worker.rs b/backend/windmill-worker/src/worker.rs index 38325dc621..5efffc307d 100644 --- a/backend/windmill-worker/src/worker.rs +++ b/backend/windmill-worker/src/worker.rs @@ -300,6 +300,7 @@ impl AuthedClientBackgroundTask { base_internal_url: self.base_internal_url.clone(), workspace: self.workspace.clone(), token: self.get_token().await, + force_client: None, }; } pub async fn get_token(&self) -> String { @@ -311,11 +312,15 @@ pub struct AuthedClient { pub base_internal_url: String, pub workspace: String, pub token: String, + pub force_client: Option, } impl AuthedClient { pub async fn get(&self, url: &str, query: Vec<(&str, String)>) -> anyhow::Result { - Ok(HTTP_CLIENT + Ok(self + .force_client + .as_ref() + .unwrap_or(&HTTP_CLIENT) .get(url) .query(&query) .header( @@ -450,8 +455,12 @@ async fn handle_receive_completed_job< let metrics = build_language_metrics(&worker_execution_failed.clone(), &jc.job.language); let token = jc.token.clone(); let workspace = jc.job.workspace_id.clone(); - let client = - AuthedClient { base_internal_url: base_internal_url.to_string(), workspace, token }; + let client = AuthedClient { + base_internal_url: base_internal_url.to_string(), + workspace, + token, + force_client: None, + }; let job = jc.job.clone(); let mem_peak = jc.mem_peak.clone(); if let Err(err) = process_completed_job(