Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Unable to create Library Panels #1567

Closed
SeamusGrafana opened this issue May 14, 2024 · 4 comments
Closed

[Bug]: Unable to create Library Panels #1567

SeamusGrafana opened this issue May 14, 2024 · 4 comments

Comments

@SeamusGrafana
Copy link

Terraform Version

1.8.2

Terraform Grafana Provider Version

2.19.0

Grafana Version

11.1.0-69372

Affected Resource(s)

  • grafana_library_panel

Terraform Configuration Files

resource "grafana_library_panel" "react_gauge" {
  name = "React Gauge"
  uid  = "g1sNpCaMz"
  model_json = jsonencode({
    "cacheTimeout" : null,
    "datasource" : null,
    "fieldConfig" : {
      "defaults" : {
        "color" : {
          "mode" : "thresholds"
        },
        "custom" : {},
        "links" : [
          {
            "targetBlank" : true,
            "title" : "Go to drilldown",
            "url" : "/d/O6GmNPvWk/dashboard-tests-nested-template-variables-drilldown?orgId=1&$${__all_variables}&$${__url_time_range}"
          }
        ],
        "mappings" : [],
        "max" : 100,
        "min" : 0,
        "nullValueMode" : "connected",
        "thresholds" : {
          "mode" : "absolute",
          "steps" : [
            {
              "color" : "green",
              "value" : null
            },
            {
              "color" : "red",
              "value" : 80
            }
          ]
        },
        "unit" : "none"
      },
      "overrides" : []
    },
    "gridPos" : {
      "h" : 9,
      "w" : 4,
      "x" : 16,
      "y" : 0
    },
    "id" : 8,
    "links" : [],
    "options" : {
      "orientation" : "horizontal",
      "reduceOptions" : {
        "calcs" : [
          "mean"
        ],
        "fields" : "",
        "values" : false
      },
      "showThresholdLabels" : false,
      "showThresholdMarkers" : true,
      "text" : {}
    },
    "pluginVersion" : "9.0.0",
    "targets" : [
      {
        "refId" : "A",
        "scenarioId" : "random_walk"
      }
    ],
    "timeFrom" : null,
    "timeShift" : null,
    "title" : "React gauge datalink",
    "type" : "gauge"
  })
}

Expected Behavior

Library Panel should create successfully.

Actual Behavior

╷
│ Error: [POST /library-elements][500] createLibraryElementInternalServerError {"error":"Server Error","message":"Internal Server Error - Please try again. If the issue persists please open a support ticket that notes the time in UTC."}
│ 
│   with module.grafana_supportlab_shared.grafana_library_panel.react_gauge,
│   on ../../../../as-code/terraform/modules/grafana_supportlab_shared/library_panels.tf line 120, in resource "grafana_library_panel" "react_gauge":
│  120: resource "grafana_library_panel" "react_gauge" {
|

Steps to Reproduce

Add the above TF Config to a working Grafana Provider Configuration
Run Terraform Plan
Verify Plan looks ok
Run Terraform Apply
Observe Error

Important Factoids

Running on Grafana Cloud

Can see following in Grafana Logs when run locally;

t=2024-05-14T15:08:17.086215814Z level=error msg="Request error" error="runtime error: invalid memory address or nil pointer dereference"

Unsure if this is something in the way TF does things or a bug in Grafana. However creating Library Panel in UI works as expected.

References

No response

@julienduchesne
Copy link
Member

Can you try with v3? For me, this resource works with both with a local 11.0.0 instance and in Grafana Cloud

@SeamusGrafana
Copy link
Author

Thanks, I tried again with v3 and still see the same issue.

However, I do note that it works fine on 11.0.0 locally (Enterprise, running in Docker) when testing just now, but not on the two Cloud Instances I tested on. Besides the Cloud/Enterprise differences, the only other major difference was the Enterprise instance was fresh and pretty empty (no Dashboards / Datasources (except the one used in the Panels), etc setup yet.

Internal Logs, suggest there is a Panic happening at the time.

@julienduchesne
Copy link
Member

If it's a panic on Grafana's side, I would lean towards opening an issue in the Grafana repo instead. It really shouldn't panic, ever.

@SeamusGrafana
Copy link
Author

Ok, thanks will open one there then. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants