aws-observability / amazon-managed-grafana-migrator

CLI migration utility to migrate Grafana content to Amazon Managed Grafana
Apache License 2.0
26 stars 7 forks source link

[Bug]: discover command fails when Grafana workspace is creating #9

Closed davidmgre closed 1 year ago

davidmgre commented 1 year ago

Did you search for similar issues before submitting?

Release version

0.1.3

Is it a permission issue?

What is your environment, configuration and the example used?

If an AMG workspace is being created, the tool has the following error:

[ec2-user@ip-172-31-0-89 ~]$ ./amazon-managed-grafana-migrator discover --region us-east-2
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x8a72e5]

goroutine 1 [running]:
github.com/aws-observability/amazon-managed-grafana-migrator/internal/pkg/aws.(*AMG).ListWorkspaces(0xc000061f80)
    /github/workspace/internal/pkg/aws/aws.go:68 +0x125
github.com/aws-observability/amazon-managed-grafana-migrator/internal/pkg/cli.discover({0x7ffe92411628, 0x9})
    /github/workspace/internal/pkg/cli/discover.go:28 +0xca
github.com/aws-observability/amazon-managed-grafana-migrator/internal/pkg/cli.BuildDiscoverCmd.func1(0x0?, {0x0?, 0x0?, 0x0?})
    /github/workspace/internal/pkg/cli/discover.go:58 +0x4c
github.com/aws-observability/amazon-managed-grafana-migrator/internal/pkg/cli.runCmdE.func1(0xc000004c00?, {0xc00006b2a0?, 0x2?, 0x2?})
    /github/workspace/internal/pkg/cli/discover.go:73 +0x7b
github.com/spf13/cobra.(*Command).execute(0xc000004c00, {0xc00006b280, 0x2, 0x2})
    /go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0xc000004900)
    /go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
    /go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992
main.main()
    /github/workspace/main.go:22 +0x1e

Once the workspace completes creation, it works as expected:

[ec2-user@ip-172-31-0-89 ~]$ ./amazon-managed-grafana-migrator discover --region us-east-2
✔ Discovered 1 workspaces

Version: 9.4
Name: grafana
Endpoint: g-123456789.grafana-workspace.us-east-2.amazonaws.com

[ec2-user@ip-172-31-0-89 ~]$

Additional Information

No response

bonclay7 commented 1 year ago

Thanks for opening this! #11 should fix it

bonclay7 commented 1 year ago

Fixed in https://github.com/aws-observability/amazon-managed-grafana-migrator/releases/tag/v0.1.5