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

Flowpipe crashed when passing wrong param in step block #140

Closed Priyanka-Chatterjee-2000 closed 8 months ago

Priyanka-Chatterjee-2000 commented 11 months ago
flowpipe-mod-discord % flowpipe service start
panic: runtime error: index out of range [2] with length 2

goroutine 1 [running]:
github.com/turbot/flowpipe/pipeparser/error_helpers.FailOnError({0x12c146bc8, 0x140009a75f0})
    /home/runner/work/flowpipe/flowpipe/flowpipe/pipeparser/error_helpers/utils.go:33 +0x54
github.com/turbot/flowpipe/internal/cmd/service.ServiceStartCmd.startManagerFunc.func1(0x1400091c800?, {0x104a36c00?, 0x4?, 0x1033d605d?})
    /home/runner/work/flowpipe/flowpipe/flowpipe/internal/cmd/service/start.go:71 +0x98
github.com/spf13/cobra.(*Command).execute(0x140005ae900, {0x104a36c00, 0x0, 0x0})
    /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:944 +0x640
github.com/spf13/cobra.(*Command).ExecuteC(0x140005ae300)
    /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x320
github.com/spf13/cobra.(*Command).Execute(...)
    /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992
github.com/turbot/flowpipe/internal/cmd.RunCLI({0x103cfcff8?, 0x14000645380?})
    /home/runner/work/flowpipe/flowpipe/flowpipe/internal/cmd/cmd.go:14 +0x2c
main.main()
    /home/runner/work/flowpipe/flowpipe/flowpipe/main.go:38 +0x248
Joeturbot commented 11 months ago

A pipeline to generate the same error.

pipeline "scan_url" {
  title       = "Submit a URL for scanning"
  description = "Submit a URL for scanning by VirusTotal."

  param "api_key" {
    type        = string
    description = "VirusTotal API key"
    default     = var.api_key
  }

  param "url" {
    type        = string
    description = "URL to scan"
    default     = var.url
  }

  step "http" "scan_url" {
    title              = "Scan url"
    description        = "Submit a URL to VirusTotal for scanning."
    # curl --request POST \
    #  --url https://www.virustotal.com/api/v3/urls \
    #  --form url=<Your URL here>
    #  --header 'x-apikey: <your API key>'
    insecure           = "false"
    url                = "https://www.virustotal.com/api/v3/urls"
    method             = "post"
    request_timeout_ms = 20000
    request_body       = "url=${parm.url}"
    request_headers    = {
      x-apikey = "${var.api_key}"
      Content-Type : "application/x-www-form-urlencoded"
    }
  }

  output "status_code" {
    value = step.http.list_issues.status_code
  }
}
Joeturbot commented 11 months ago

Changing request_body = "url=${parm.url}" to request_body = "url=${param.url}" resolve the panic: runtime error: index out of range [2] with length 2 error.

github-actions[bot] commented 9 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] commented 8 months ago

This issue was closed because it has been stalled for 90 days with no activity.

vhadianto commented 7 months ago

Verified in v0.3 main this issue is no longer valid. We have the following parse error:

Bad Request: invalid property path: pram.name

if there's an invalid reference to param/resources.