diff --git a/README.md b/README.md index dab1b82495..a5364df93b 100644 --- a/README.md +++ b/README.md @@ -363,7 +363,7 @@ it being synced automatically everyday. | SMTP_PASSWORD | None | password for the smtp server to send invite emails | Server | | SMTP_TLS_IMPLICIT | false | https://docs.rs/mail-send/latest/mail_send/struct.SmtpClientBuilder.html#method.implicit_tlsemails | Server | | CREATE_WORKSPACE_REQUIRE_SUPERADMIN | true | If true, only superadmin can create workspaces | Server | -| GLOBAL_ERROR_HANDLER_PATH_IN_ADMINS_WORKSPACE | None | Path to a script to run when a root job fails. The script will be run in and from the admins workspace | Server | +| GLOBAL_ERROR_HANDLER_PATH_IN_ADMINS_WORKSPACE | None | Path to a script or flow to run when a root job fails. The path needs to be prefixed with either `script/` or `flow/` to indicate the kind of error handler being used (assuming `script/` by default). The error handler will be run in and from the admins workspace | Server | | WHITELIST_ENVS | None | List of envs variables, separated by a ',' that are whitelisted as being safe to passthrough the workers | Worker | | SAML_METADATA | None | SAML Metadata URL to enable SAML SSO (EE only) | Server | | SECRET_SALT | None | Secret Salt used for encryption and decryption of secrets. If defined, the secrets will not be decryptable unless the right salt is passed in, which is the case for the workers and the server | Server + Worker | diff --git a/backend/Cargo.lock b/backend/Cargo.lock index 9e240147a0..c56dd51a80 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -587,23 +587,23 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "aws-config" -version = "0.57.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2bf00cb9416daab4ce4927c54ebe63c08b9caf4d7b9314b6d7a4a2c5a1afb09" +checksum = "8e245d7c741a8e4b23133f36750c4bcb3938a66ac49510caaf8b83afd52db1ec" dependencies = [ - "aws-credential-types", - "aws-http", - "aws-runtime", + "aws-credential-types 1.0.0", + "aws-http 0.60.0", + "aws-runtime 1.0.0", "aws-sdk-sso", "aws-sdk-ssooidc", "aws-sdk-sts", - "aws-smithy-async", - "aws-smithy-http", - "aws-smithy-json", - "aws-smithy-runtime", - "aws-smithy-runtime-api", - "aws-smithy-types", - "aws-types", + "aws-smithy-async 1.0.1", + "aws-smithy-http 0.60.0", + "aws-smithy-json 0.60.0", + "aws-smithy-runtime 1.0.1", + "aws-smithy-runtime-api 1.0.1", + "aws-smithy-types 1.0.1", + "aws-types 1.0.0", "bytes", "fastrand 2.0.1", "hex", @@ -622,9 +622,21 @@ version = "0.57.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb9073c88dbf12f68ce7d0e149f989627a1d1ae3d2b680459f04ccc29d1cbd0f" dependencies = [ - "aws-smithy-async", - "aws-smithy-runtime-api", - "aws-smithy-types", + "aws-smithy-async 0.57.2", + "aws-smithy-runtime-api 0.57.2", + "aws-smithy-types 0.57.2", + "zeroize", +] + +[[package]] +name = "aws-credential-types" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6dec6f3d42983be70a113f999476185e124884f43f4d60129c7157aede7bda1" +dependencies = [ + "aws-smithy-async 1.0.1", + "aws-smithy-runtime-api 1.0.1", + "aws-smithy-types 1.0.1", "zeroize", ] @@ -634,10 +646,26 @@ version = "0.57.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24067106d09620cf02d088166cdaedeaca7146d4d499c41b37accecbea11b246" dependencies = [ - "aws-smithy-http", - "aws-smithy-runtime-api", - "aws-smithy-types", - "aws-types", + "aws-smithy-http 0.57.2", + "aws-smithy-runtime-api 0.57.2", + "aws-smithy-types 0.57.2", + "aws-types 0.57.2", + "bytes", + "http", + "http-body", + "pin-project-lite", + "tracing", +] + +[[package]] +name = "aws-http" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "361c4310fdce94328cc2d1ca0c8a48c13f43009c61d3367585685a50ca8c66b6" +dependencies = [ + "aws-smithy-runtime-api 1.0.1", + "aws-smithy-types 1.0.1", + "aws-types 1.0.0", "bytes", "http", "http-body", @@ -651,15 +679,36 @@ version = "0.57.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6ee0152c06d073602236a4e94a8c52a327d310c1ecd596570ce795af8777ff" dependencies = [ - "aws-credential-types", - "aws-http", - "aws-sigv4", - "aws-smithy-async", + "aws-credential-types 0.57.2", + "aws-http 0.57.2", + "aws-sigv4 0.57.2", + "aws-smithy-async 0.57.2", "aws-smithy-eventstream", - "aws-smithy-http", - "aws-smithy-runtime-api", - "aws-smithy-types", - "aws-types", + "aws-smithy-http 0.57.2", + "aws-smithy-runtime-api 0.57.2", + "aws-smithy-types 0.57.2", + "aws-types 0.57.2", + "fastrand 2.0.1", + "http", + "percent-encoding", + "tracing", + "uuid 1.6.1", +] + +[[package]] +name = "aws-runtime" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36ba3ad97d674bfaeed684d528a07cee6e81cbf16e6d6c7e272a130b5e71e6b9" +dependencies = [ + "aws-credential-types 1.0.0", + "aws-http 0.60.0", + "aws-sigv4 1.0.0", + "aws-smithy-async 1.0.1", + "aws-smithy-http 0.60.0", + "aws-smithy-runtime-api 1.0.1", + "aws-smithy-types 1.0.1", + "aws-types 1.0.0", "fastrand 2.0.1", "http", "percent-encoding", @@ -673,20 +722,20 @@ version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf188e8af89adb0b41ae2f21b6c666c618959e40242e79aaa43fafa9c0c90a8a" dependencies = [ - "aws-credential-types", - "aws-http", - "aws-runtime", - "aws-sigv4", - "aws-smithy-async", + "aws-credential-types 0.57.2", + "aws-http 0.57.2", + "aws-runtime 0.57.2", + "aws-sigv4 0.57.2", + "aws-smithy-async 0.57.2", "aws-smithy-checksums", "aws-smithy-eventstream", - "aws-smithy-http", - "aws-smithy-json", - "aws-smithy-runtime", - "aws-smithy-runtime-api", - "aws-smithy-types", - "aws-smithy-xml", - "aws-types", + "aws-smithy-http 0.57.2", + "aws-smithy-json 0.57.2", + "aws-smithy-runtime 0.57.2", + "aws-smithy-runtime-api 0.57.2", + "aws-smithy-types 0.57.2", + "aws-smithy-xml 0.57.2", + "aws-types 0.57.2", "bytes", "http", "http-body", @@ -699,20 +748,20 @@ dependencies = [ [[package]] name = "aws-sdk-sso" -version = "0.36.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb8158015232b4596ccef74a205600398e152d704b40b7ec9f486092474d7fa" +checksum = "5786afe1fd164e53f108b2bd4982a31c5a821dc1677d05a12de65ebcc6ede52a" dependencies = [ - "aws-credential-types", - "aws-http", - "aws-runtime", - "aws-smithy-async", - "aws-smithy-http", - "aws-smithy-json", - "aws-smithy-runtime", - "aws-smithy-runtime-api", - "aws-smithy-types", - "aws-types", + "aws-credential-types 1.0.0", + "aws-http 0.60.0", + "aws-runtime 1.0.0", + "aws-smithy-async 1.0.1", + "aws-smithy-http 0.60.0", + "aws-smithy-json 0.60.0", + "aws-smithy-runtime 1.0.1", + "aws-smithy-runtime-api 1.0.1", + "aws-smithy-types 1.0.1", + "aws-types 1.0.0", "bytes", "http", "regex", @@ -721,20 +770,20 @@ dependencies = [ [[package]] name = "aws-sdk-ssooidc" -version = "0.36.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36a1493e1c57f173e53621935bfb5b6217376168dbdb4cd459aebcf645924a48" +checksum = "31569ac7750ebc3097058c1e72d79576e16b3fb262aa0d6510188bff623f9804" dependencies = [ - "aws-credential-types", - "aws-http", - "aws-runtime", - "aws-smithy-async", - "aws-smithy-http", - "aws-smithy-json", - "aws-smithy-runtime", - "aws-smithy-runtime-api", - "aws-smithy-types", - "aws-types", + "aws-credential-types 1.0.0", + "aws-http 0.60.0", + "aws-runtime 1.0.0", + "aws-smithy-async 1.0.1", + "aws-smithy-http 0.60.0", + "aws-smithy-json 0.60.0", + "aws-smithy-runtime 1.0.1", + "aws-smithy-runtime-api 1.0.1", + "aws-smithy-types 1.0.1", + "aws-types 1.0.0", "bytes", "http", "regex", @@ -743,22 +792,22 @@ dependencies = [ [[package]] name = "aws-sdk-sts" -version = "0.36.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e032b77f5cd1dd3669d777a38ac08cbf8ec68e29460d4ef5d3e50cffa74ec75a" +checksum = "9b1d955bacd8c3637908a40a4af2f7a732461ee7d95ec02599a3610ee55781d7" dependencies = [ - "aws-credential-types", - "aws-http", - "aws-runtime", - "aws-smithy-async", - "aws-smithy-http", - "aws-smithy-json", + "aws-credential-types 1.0.0", + "aws-http 0.60.0", + "aws-runtime 1.0.0", + "aws-smithy-async 1.0.1", + "aws-smithy-http 0.60.0", + "aws-smithy-json 0.60.0", "aws-smithy-query", - "aws-smithy-runtime", - "aws-smithy-runtime-api", - "aws-smithy-types", - "aws-smithy-xml", - "aws-types", + "aws-smithy-runtime 1.0.1", + "aws-smithy-runtime-api 1.0.1", + "aws-smithy-types 1.0.1", + "aws-smithy-xml 0.60.0", + "aws-types 1.0.0", "http", "regex", "tracing", @@ -770,10 +819,10 @@ version = "0.57.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64f81a6abc4daab06b53cabf27c54189928893283093e37164ca53aa47488a5b" dependencies = [ - "aws-credential-types", + "aws-credential-types 0.57.2", "aws-smithy-eventstream", - "aws-smithy-http", - "aws-smithy-runtime-api", + "aws-smithy-http 0.57.2", + "aws-smithy-runtime-api 0.57.2", "bytes", "form_urlencoded", "hex", @@ -791,6 +840,29 @@ dependencies = [ "zeroize", ] +[[package]] +name = "aws-sigv4" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4d07e2f2fc32acb7423d054ec8ba2b361dafc95fabc5a211baf4a566571d20e" +dependencies = [ + "aws-credential-types 1.0.0", + "aws-smithy-http 0.60.0", + "aws-smithy-runtime-api 1.0.1", + "aws-smithy-types 1.0.1", + "bytes", + "form_urlencoded", + "hex", + "hmac", + "http", + "once_cell", + "percent-encoding", + "regex", + "sha2 0.10.8", + "time", + "tracing", +] + [[package]] name = "aws-smithy-async" version = "0.57.2" @@ -802,14 +874,25 @@ dependencies = [ "tokio", ] +[[package]] +name = "aws-smithy-async" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbfa248f7f966d73e325dbc85851a5500042b6d96e3c3b535a8527707f36fe4" +dependencies = [ + "futures-util", + "pin-project-lite", + "tokio", +] + [[package]] name = "aws-smithy-checksums" version = "0.57.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fb5701fbfb40600cc0fa547f318552dfd4e632b2099bd75d95fb0faae70675d" dependencies = [ - "aws-smithy-http", - "aws-smithy-types", + "aws-smithy-http 0.57.2", + "aws-smithy-types 0.57.2", "bytes", "crc32c", "crc32fast", @@ -829,7 +912,7 @@ version = "0.57.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b33fa99f928a5815b94ee07e1377901bcf51aa749034a2c802dc38f9dcfacf5" dependencies = [ - "aws-smithy-types", + "aws-smithy-types 0.57.2", "bytes", "crc32fast", ] @@ -841,8 +924,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7972373213d1d6e619c0edc9dda2d6634154e4ed75c5e0b2bf065cd5ec9f0d1" dependencies = [ "aws-smithy-eventstream", - "aws-smithy-runtime-api", - "aws-smithy-types", + "aws-smithy-runtime-api 0.57.2", + "aws-smithy-types 0.57.2", + "bytes", + "bytes-utils", + "futures-core", + "http", + "http-body", + "once_cell", + "percent-encoding", + "pin-project-lite", + "pin-utils", + "tracing", +] + +[[package]] +name = "aws-smithy-http" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b1de8aee22f67de467b2e3d0dd0fb30859dc53f579a63bd5381766b987db644" +dependencies = [ + "aws-smithy-runtime-api 1.0.1", + "aws-smithy-types 1.0.1", "bytes", "bytes-utils", "futures-core", @@ -861,16 +964,25 @@ version = "0.57.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6d64d5af16dd585de9ff6c606423c1aaad47c6baa38de41c2beb32ef21c6645" dependencies = [ - "aws-smithy-types", + "aws-smithy-types 0.57.2", +] + +[[package]] +name = "aws-smithy-json" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a46dd338dc9576d6a6a5b5a19bd678dcad018ececee11cf28ecd7588bd1a55c" +dependencies = [ + "aws-smithy-types 1.0.1", ] [[package]] name = "aws-smithy-query" -version = "0.57.2" +version = "0.60.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7527bf5335154ba1b285479c50b630e44e93d1b4a759eaceb8d0bf9fbc82caa5" +checksum = "feb5b8c7a86d4b6399169670723b7e6f21a39fc833a30f5c5a2f997608178129" dependencies = [ - "aws-smithy-types", + "aws-smithy-types 1.0.1", "urlencoding", ] @@ -880,10 +992,34 @@ version = "0.57.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "839b363adf3b2bdab2742a1f540fec23039ea8bc9ec0f9f61df48470cfe5527b" dependencies = [ - "aws-smithy-async", - "aws-smithy-http", - "aws-smithy-runtime-api", - "aws-smithy-types", + "aws-smithy-async 0.57.2", + "aws-smithy-http 0.57.2", + "aws-smithy-runtime-api 0.57.2", + "aws-smithy-types 0.57.2", + "bytes", + "fastrand 2.0.1", + "http", + "http-body", + "hyper", + "hyper-rustls", + "once_cell", + "pin-project-lite", + "pin-utils", + "rustls 0.21.9", + "tokio", + "tracing", +] + +[[package]] +name = "aws-smithy-runtime" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "064b808143d80b50744b1b22cce801238a545b84859c6cf8e275997252dd1d25" +dependencies = [ + "aws-smithy-async 1.0.1", + "aws-smithy-http 0.60.0", + "aws-smithy-runtime-api 1.0.1", + "aws-smithy-types 1.0.1", "bytes", "fastrand 2.0.1", "http", @@ -904,8 +1040,23 @@ version = "0.57.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f24ecc446e62c3924539e7c18dec8038dba4fdf8718d5c2de62f9d2fecca8ba9" dependencies = [ - "aws-smithy-async", - "aws-smithy-types", + "aws-smithy-async 0.57.2", + "aws-smithy-types 0.57.2", + "bytes", + "http", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "aws-smithy-runtime-api" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d27c3235d4972ed976b5c1a82286e7c4457f618f3c2ae6d4ae44f081dd24575" +dependencies = [ + "aws-smithy-async 1.0.1", + "aws-smithy-types 1.0.1", "bytes", "http", "pin-project-lite", @@ -937,6 +1088,27 @@ dependencies = [ "tokio-util", ] +[[package]] +name = "aws-smithy-types" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fc32035dc0636a8583cf0c6dd7f1e6d5404103b836d26228b8730907a88d9f" +dependencies = [ + "base64-simd", + "bytes", + "bytes-utils", + "futures-core", + "http", + "http-body", + "itoa", + "num-integer", + "pin-project-lite", + "pin-utils", + "ryu", + "serde", + "time", +] + [[package]] name = "aws-smithy-xml" version = "0.57.2" @@ -946,16 +1118,40 @@ dependencies = [ "xmlparser", ] +[[package]] +name = "aws-smithy-xml" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec40d74a67fd395bc3f6b4ccbdf1543672622d905ef3f979689aea5b730cb95" +dependencies = [ + "xmlparser", +] + [[package]] name = "aws-types" version = "0.57.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "048bbf1c24cdf4eb1efcdc243388a93a90ebf63979e25fc1c7b8cbd9cb6beb38" dependencies = [ - "aws-credential-types", - "aws-smithy-async", - "aws-smithy-runtime-api", - "aws-smithy-types", + "aws-credential-types 0.57.2", + "aws-smithy-async 0.57.2", + "aws-smithy-runtime-api 0.57.2", + "aws-smithy-types 0.57.2", + "http", + "rustc_version 0.4.0", + "tracing", +] + +[[package]] +name = "aws-types" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b18c0eb301cce69298555c4884795497c67b3bd511aa3f07470382f4bf3ef043" +dependencies = [ + "aws-credential-types 1.0.0", + "aws-smithy-async 1.0.1", + "aws-smithy-runtime-api 1.0.1", + "aws-smithy-types 1.0.1", "http", "rustc_version 0.4.0", "tracing", diff --git a/backend/windmill-api/Cargo.toml b/backend/windmill-api/Cargo.toml index 0009af0768..b8ef6f16cf 100644 --- a/backend/windmill-api/Cargo.toml +++ b/backend/windmill-api/Cargo.toml @@ -83,7 +83,7 @@ candle-core.workspace = true candle-transformers.workspace = true candle-nn.workspace = true aws-sdk-s3 = "0.36.0" -aws-config = "0.57.2" +aws-config = "1.0.0" polars = { version = "0.35.2", features = ["lazy", "parquet", "aws", "csv", "dtype-full"] } polars-io = { version = "0.35.2", features = ["csv"] } object_store = { version = "0.8.0", features = ["aws"] } diff --git a/backend/windmill-queue/src/jobs.rs b/backend/windmill-queue/src/jobs.rs index 45ab4cd222..fc9994c48e 100644 --- a/backend/windmill-queue/src/jobs.rs +++ b/backend/windmill-queue/src/jobs.rs @@ -50,8 +50,7 @@ use windmill_common::{ }, flows::{add_virtual_items_if_necessary, FlowModuleValue, FlowValue}, jobs::{ - get_payload_tag_from_prefixed_path, script_path_to_payload, CompletedJob, JobKind, - JobPayload, QueuedJob, RawCode, + get_payload_tag_from_prefixed_path, CompletedJob, JobKind, JobPayload, QueuedJob, RawCode, }, oauth2::WORKSPACE_SLACK_BOT_TOKEN_PATH, schedule::Schedule, @@ -579,12 +578,13 @@ pub async fn run_error_handler< is_global: bool, ) -> Result<(), Error> { let w_id = &queued_job.workspace_id; - let script_w_id = if is_global { "admins" } else { w_id }; // script workspace id + let handler_w_id = if is_global { "admins" } else { w_id }; // script workspace id let job_id = queued_job.id; - let (job_payload, tag) = script_path_to_payload(&error_handler_path, db, script_w_id).await?; + let (job_payload, tag) = + get_payload_tag_from_prefixed_path(&error_handler_path, db, handler_w_id).await?; let mut extra = HashMap::new(); - extra.insert("workspace_id".to_string(), to_raw_value(&w_id)); + extra.insert("workspace_id".to_string(), to_raw_value(&handler_w_id)); extra.insert("job_id".to_string(), to_raw_value(&job_id)); extra.insert("path".to_string(), to_raw_value(&queued_job.script_path)); extra.insert( @@ -604,7 +604,7 @@ pub async fn run_error_handler< // TODO(gbouv): REMOVE THIS after December 1st 2023 and ping users to re-save their error handlers if error_handler_path .to_string() - .eq("hub/5792/workspace-or-schedule-error-handler-slack") + .eq("script/hub/5792/workspace-or-schedule-error-handler-slack") { // default slack error handler being used -> we need to inject the slack token let slack_resource = format!("$res:{WORKSPACE_SLACK_BOT_TOKEN_PATH}"); @@ -628,7 +628,7 @@ pub async fn run_error_handler< let (uuid, tx) = push( &db, tx, - script_w_id, + handler_w_id, job_payload, PushArgs { extra, args: result.to_owned() }, if is_global { @@ -682,12 +682,19 @@ pub async fn send_error_to_global_handler< result: Json<&'a T>, ) -> Result<(), Error> { if let Some(ref global_error_handler) = *GLOBAL_ERROR_HANDLER_PATH_IN_ADMINS_WORKSPACE { + let prefixed_global_error_handler_path = if global_error_handler.starts_with("script/") + || global_error_handler.starts_with("flow/") + { + global_error_handler.clone() + } else { + format!("script/{}", global_error_handler) + }; run_error_handler( rsmq, queued_job, db, result, - global_error_handler, + &prefixed_global_error_handler_path, None, true, ) @@ -754,7 +761,7 @@ pub async fn send_error_to_workspace_handler< queued_job, db, result, - &error_handler.strip_prefix("script/").unwrap(), + &error_handler, error_handler_extra_args, false, ) diff --git a/frontend/src/lib/components/ErrorOrRecoveryHandler.svelte b/frontend/src/lib/components/ErrorOrRecoveryHandler.svelte index 209502cb87..62151ff3ed 100644 --- a/frontend/src/lib/components/ErrorOrRecoveryHandler.svelte +++ b/frontend/src/lib/components/ErrorOrRecoveryHandler.svelte @@ -6,7 +6,14 @@ import type { Schema, SupportedLanguage } from '$lib/common' import { enterpriseLicense, workspaceStore } from '$lib/stores' import { emptySchema, emptyString, sendUserToast, tryEvery } from '$lib/utils' - import { JobService, Script, ScriptService, WorkspaceService } from '$lib/gen' + import { + FlowService, + JobService, + Script, + ScriptService, + WorkspaceService, + type Flow + } from '$lib/gen' import { inferArgs } from '$lib/infer' import { CheckCircle2, Loader2, RotateCw, XCircle } from 'lucide-svelte' @@ -86,6 +93,7 @@ } async function loadHandlerScriptArgs(p: string, defaultArgs: string[] = []) { + console.log(p) try { let schema: Schema | undefined = emptySchema() if (p.startsWith('hub/')) { @@ -99,8 +107,11 @@ await inferArgs(hubScript.language as SupportedLanguage, hubScript.content ?? '', schema) } } else { - const script = await ScriptService.getScriptByPath({ workspace: $workspaceStore!, path: p }) - schema = script.schema as Schema + let scriptOrFlow: Script | Flow = + customHandlerKind === 'script' + ? await ScriptService.getScriptByPath({ workspace: $workspaceStore!, path: p }) + : await FlowService.getFlowByPath({ workspace: $workspaceStore!, path: p }) + schema = scriptOrFlow.schema as Schema } if (schema && schema.properties) { for (let key in schema.properties) { diff --git a/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte b/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte index a40a1c2d6b..8da23856d1 100644 --- a/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte @@ -194,6 +194,7 @@ workspaceToDeployTo = settings.deploy_to webhook = settings.webhook openaiResourceInitialPath = settings.openai_resource_path + errorHandlerItemKind = settings.error_handler?.split('/')[0] as 'flow' | 'script' errorHandlerScriptPath = (settings.error_handler ?? '').split('/').slice(1).join('/') errorHandlerInitialScriptPath = errorHandlerScriptPath errorHandlerMutedOnCancel = settings.error_handler_muted_on_cancel