turbot / powerpipe

Powerpipe: Dashboards for DevOps. Visualize cloud configurations. Assess security posture against a massive library of benchmarks. Build custom dashboards with code.
https://powerpipe.io/
GNU Affero General Public License v3.0
228 stars 16 forks source link

steampipe dashboard crashes on to_timestamp when value is millis not seconds #294

Closed judell closed 2 months ago

judell commented 1 year ago

This value comes from JavaScript.

    table {
      sql = <<EOQ
        select to_timestamp(1670377316386)
      EOQ
    }

The crash:

 Dashboard execution started: fedwiki.dashboard.fedwiki
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x16b28c5]

goroutine 155 [running]:
github.com/turbot/steampipe/pkg/dashboard/dashboardserver.buildLeafNodeUpdatedPayload(0x0)
        /home/runner/work/steampipe/steampipe/pkg/dashboard/dashboardserver/payload.go:187 +0xa5
github.com/turbot/steampipe/pkg/dashboard/dashboardserver.(*Server).HandleDashboardEvent(0xc0008800f0, {0x22935e8, 0xc0004520c0}, {0x227f600?, 0x0?})
        /home/runner/work/steampipe/steampipe/pkg/dashboard/dashboardserver/server.go:149 +0x5b1
github.com/turbot/steampipe/pkg/workspace.(*Workspace).handleDashboardEvent(0xc0004e6000, {0x22935e8, 0xc0004520c0})
        /home/runner/work/steampipe/steampipe/pkg/workspace/workspace_events.go:71 +0x104
created by github.com/turbot/steampipe/pkg/workspace.(*Workspace).RegisterDashboardEventHandler
        /home/runner/work/steampipe/steampipe/pkg/workspace/workspace_events.go:47 +0xed

The fix:

    table {
      sql = <<EOQ
        select to_timestamp(1670377316386 / 1000)
      EOQ
    }
github-actions[bot] commented 1 year 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 1 year ago

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

github-actions[bot] commented 6 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.

pskrbasu commented 5 months ago

Reproduced with Powerpipe v0.1.3.

dashboard "testing_card_blocks" {
  title = "Testing card blocks"

  container {
    card "card1" {
      sql = <<-EOQ
        select 1 as card1_value
      EOQ
      width = 2
    }

    card "card2" {
      type  = "info"
      width = 2
      sql = <<-EOQ
        select to_timestamp(1670377316386)
      EOQ
    }
  }
}
[ Wait    ] Starting WorkspaceEvents Server
[ Message ] WorkspaceEvents loaded
[ Message ] Initialization complete
[ Ready   ] Dashboard server started on 9033 and listening on local
[ Message ] Visit http://localhost:9033
[ Message ] Press Ctrl+C to exit
[ Wait    ] WorkspaceEvents execution started: dashboard_cards.dashboard.testing_card_blocks
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x105f4b45c]

goroutine 86 [running]:
github.com/turbot/powerpipe/internal/dashboardserver.buildLeafNodeUpdatedPayload(0x0)
        /go/src/powerpipe/internal/dashboardserver/payload.go:261 +0x8c
github.com/turbot/powerpipe/internal/dashboardserver.(*Server).HandleDashboardEvent(0x14000864100, {0x10848fd90?, 0x1400054e580}, {0x1084741a0?, 0x0?})
        /go/src/powerpipe/internal/dashboardserver/server.go:146 +0x710
github.com/turbot/powerpipe/internal/dashboardworkspace.(*WorkspaceEvents).handleDashboardEvent(0x14000937740, {0x10848fd90, 0x1400054e580})
        /go/src/powerpipe/internal/dashboardworkspace/workspace_events.go:66 +0x118
created by github.com/turbot/powerpipe/internal/dashboardworkspace.(*WorkspaceEvents).RegisterDashboardEventHandler in goroutine 1
        /go/src/powerpipe/internal/dashboardworkspace/workspace_events.go:42 +0xe0

powerpipe query run "select to_timestamp(1670377316386)" - WORKS steampipe query "select to_timestamp(1670377316386)" - WORKS

github-actions[bot] commented 3 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 2 months ago

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