grafana/grizzly

[Bug]: Nil pointer exception when pulling synthetic checks

Closed this issue · 0 comments

Grizzly Version

0.4.0

Expected Behavior

➜  grizzly git:(main) ✗ ./grr pull -d resources --output json -t SyntheticMonitoringCheck
INFO[0000] Providers:
  Grafana - active
  Mimir - inactive: exec: "cortextool": executable file not found in $PATH
  Synthetic Monitoring - active 
Flag --directory has been deprecated, now it is inferred from the operating system
INFO[0000] Pulling resources to resources               
AlertNotificationPolicy skipped
AlertContactPoint skipped
Pulling 1 resources
SyntheticMonitoringCheck.Test Monitor pulled

Actual Behavior

➜  grizzly git:(main) ✗ ./grr pull -d resources --output json -t SyntheticMonitoringCheck
INFO[0000] Providers:
  Grafana - active
  Mimir - inactive: exec: "cortextool": executable file not found in $PATH
  Synthetic Monitoring - active 
Flag --directory has been deprecated, now it is inferred from the operating system
INFO[0000] Pulling resources to resources               
AlertContactPoint skipped
Pulling 1 resources
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x18 pc=0x102f69784]

goroutine 1 [running]:
github.com/grafana/grizzly/pkg/grizzly.(*BaseHandler).APIVersion(...)
        /Users/dmanc/github/grizzly/pkg/grizzly/handler.go:26
github.com/grafana/grizzly/pkg/syntheticmonitoring.(*SyntheticMonitoringHandler).getRemoteCheck(0x140004f3d70, {0x1400046ebc0, 0x1d})
        /Users/dmanc/github/grizzly/pkg/syntheticmonitoring/synthetic-monitoring-handler.go:225 +0x454
github.com/grafana/grizzly/pkg/syntheticmonitoring.(*SyntheticMonitoringHandler).GetByUID(0x0?, {0x1400046ebc0?, 0x18?})
        /Users/dmanc/github/grizzly/pkg/syntheticmonitoring/synthetic-monitoring-handler.go:115 +0x20
github.com/grafana/grizzly/pkg/grizzly.Pull({{0x14000415900, 0x2, 0x2}, 0x140004f3bf0, {0x1400003d380, 0x8, 0x8}}, {0x16d93f29e, 0x9}, 0x0?, ...)
        /Users/dmanc/github/grizzly/pkg/grizzly/workflow.go:157 +0x4c4
main.pullCmd.func1(0x140001f5000?, {0x14000697320, 0x1, 0x1026935a8?})
        /Users/dmanc/github/grizzly/cmd/grr/workflow.go:114 +0x118
main.initialiseOnlySpec.func1(0x14000011b38?, {0x14000697320, 0x1, 0x6})
        /Users/dmanc/github/grizzly/cmd/grr/workflow.go:522 +0x74
main.initialiseLogging.func1(0x140001f5000?, {0x14000697320, 0x1, 0x6})
        /Users/dmanc/github/grizzly/cmd/grr/workflow.go:537 +0x94
github.com/go-clix/cli.(*Command).execute(0x140003cc640, {0x140006972c0, 0x6, 0x6})
        /Users/dmanc/go/pkg/mod/github.com/go-clix/cli@v0.2.0/command.go:118 +0x390
github.com/go-clix/cli.(*Command).Execute(0x140004fd2c0)
        /Users/dmanc/go/pkg/mod/github.com/go-clix/cli@v0.2.0/command.go:76 +0xc8
main.main()
        /Users/dmanc/github/grizzly/cmd/grr/main.go:89 +0x938
      

Steps to Reproduce

No response