turbot / flowpipe

Flowpipe is a cloud scripting engine. Automation and workflow to connect your clouds to the people, systems and data that matters.
https://flowpipe.io
GNU Affero General Public License v3.0
361 stars 13 forks source link

Better error handling for `notifier =` in message step #826

Closed e-gineer closed 4 months ago

e-gineer commented 6 months ago

Accidentally passing a string to notifier = causes an unhelpful error message and doing the same thing via a param is an outright crash.

Here is a sample mod to reproduce:

mod "local" {
  title = "flowpipe-mod-issues"
}

pipeline "notifier_reference_errors" {

  param "notifier" {
    type = string
    default = "default"
  }

  step "message" "simple_notifier_works" {
    notifier = notifier.default
    text = "test message"
  }

  step "message" "notifier_name_bug_unhelpful_error" {
    # accidentially give notifier name instead of actual notifier
    # Error: value is not a collection
    notifier = "default"
    text = "test message"
  }

  step "message" "notifier_param_crashes" {
    # accidentially give notifier name via param
    # [flowpipe] Execution ID: exec_co6pb1so47mlvo0cjbjg
    # {"time":"2024-04-03T13:44:39.109068-04:00","level":"ERROR","msg":"Recovered from panic","error":null}
    # [notifier_reference_errors] Starting pipeline
    notifier = param.notifier
    text = "test message"
  }

}
vhadianto commented 5 months ago

Fix in pipe-fittings: https://github.com/turbot/pipe-fittings/commit/1e8c45ada716a0fc49d830cab2bfa85c44b857b8

vhadianto commented 4 months ago

Fixed in https://github.com/turbot/flowpipe/releases/tag/v0.4.4