K-Phoen / backstage-plugin-grafana

Grafana plugin for Backstage
Apache License 2.0
53 stars 28 forks source link

Missing required config value at 'grafana.domain' #67

Open MHoinkaBS opened 1 year ago

MHoinkaBS commented 1 year ago

Hi, I've encountered a problem while trying to add the Grafana plugin to the Backstage.

I have a Grafana tile on the component page but it shows an error:

Error

Missing required config value at 'grafana.domain'

Error: Missing required config value at 'grafana.domain'
    at I.getString (http://localhost:7007/static/module-backstage.43ebf01d.js:9:31881)
    at Object.factory (http://localhost:7007/static/module-k-phoen.ad3b7d0d.js:1:5163)
    at Y.load (http://localhost:7007/static/module-backstage.43ebf01d.js:9:34243)
    at Y.get (http://localhost:7007/static/module-backstage.43ebf01d.js:9:33998)
    at n (http://localhost:7007/static/module-backstage.43ebf01d.js:40:85264)
    at y (http://localhost:7007/static/870.829e099c.chunk.js:1:1011)
    at Gl (http://localhost:7007/static/module-react-dom.cde93b43.js:12:52799)
    at hs (http://localhost:7007/static/module-react-dom.cde93b43.js:16:8596)
    at cs (http://localhost:7007/static/module-react-dom.cde93b43.js:16:930)
    at Za (http://localhost:7007/static/module-react-dom.cde93b43.js:16:861)

Plugin installed as described here: https://github.com/K-Phoen/backstage-plugin-grafana/blob/main/docs/index.md#installation

My configuration:

EntityPage.tsx

import { EntityGrafanaDashboardsCard } from '@k-phoen/backstage-plugin-grafana';
// ...
const overviewContent = (
  <Grid container spacing={3} alignItems="stretch">
    {entityWarningContent}
    (...)
    <Grid item md={6}>
      <EntityGrafanaDashboardsCard />
    </Grid>
    (...)
  </Grid>
);

app-config.yaml

proxy:
//...
  '/grafana/api':
    target: https://grafana.my.tech
    headers:
      Authorization: Bearer {API_token}

//...      

grafana:
  domain: https://grafana.my.tech
  unifiedAlerting: false

catalog-info.yaml

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: Training
  description: Training
  annotations:
    grafana/dashboard-selector: alerts-test

In config.d.ts. of the plugin there is domain: string declared in the Config interface.

I have also a Sonarqube plugin and it does not have problem with baseUrl.
Backstage is running localy in Docker container. Network traffic to Grafana is open.

When I tried to Embed dashboards on a component page (as described here: https://github.com/K-Phoen/backstage-plugin-grafana/blob/main/docs/embed-dashboards-on-page.md ) I've got grafana.my.tech is blocked so I assume in that case grafana.domain value has been passed as expected.

I will be grateful for help.