grafana / grafana-image-renderer

A Grafana backend plugin that handles rendering of panels & dashboards to PNGs using headless browser (Chromium/Chrome)
Apache License 2.0
370 stars 150 forks source link

[3.11.1] Error rendering template: error. You may need to build frontend assets #546

Open mousimin opened 1 month ago

mousimin commented 1 month ago

What happened: Tried the simple docker file here: https://github.com/grafana/grafana-image-renderer/blob/master/devenv/docker/simple/docker-compose.yaml I could started two containers successfully, but got error when I clicked "Direct link rendered image" from Grafana UI(I didn't add any datasource, just use 'Random Walk for Grafana' for Grafana builtin data source), I couldn't be able to get the image. No error log from the renderer, but had error logs from Grafana:

grafana-1   | logger=context userId=1 orgId=1 uname=admin t=2024-07-18T03:31:01.348580762Z level=error msg="Rendering failed." error="remote rendering request failed, status code: 503, status: 503 Service Unavailable"
grafana-1   | logger=context userId=1 orgId=1 uname=admin t=2024-07-18T03:31:01.350074961Z level=error msg="Request error" error="Context.HTML - Error rendering template: error. You may need to build frontend assets \n template: error:16:42: executing \"error\" at <.Assets.Dark>: can't evaluate field Assets in type struct { Title string; AppTitle string; AppSubUrl string; ThemeType string; ErrorMsg error }" stack="github.com/grafana/grafana/pkg/web/context.go:112 (0x74e8064)\ngithub.com/grafana/grafana/pkg/services/contexthandler/model/model.go:54 (0x74f3328)\ngithub.com/grafana/grafana/pkg/api/render.go:106 (0xa44612a)\ngithub.com/grafana/grafana/pkg/api/response/web_hack.go:40 (0x74f94af)\nnet/http/server.go:2166 (0x74e90f8)\ngithub.com/grafana/grafana/pkg/web/macaron.go:131 (0x74e90b5)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/services/contexthandler/contexthandler.go:141 (0xa4505f4)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/render.go:44 (0x74e9c0b)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/middleware/csrf/csrf.go:66 (0x98f45af)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/middleware/recovery.go:180 (0xa428ffd)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/middleware/loggermw/logger.go:72 (0x98f553e)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/middleware/request_metrics.go:75 (0x82b19ed)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/middleware/request_tracing.go:88 (0xa429d75)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/middleware/requestmeta/request_metadata.go:66 (0xa44f6e1)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/context.go:52 (0x74e79fa)\ngithub.com/grafana/grafana/pkg/web/router.go:155 (0x74eb3ed)\ngithub.com/grafana/grafana/pkg/web/router.go:221 (0x74ebf14)\ngithub.com/grafana/grafana/pkg/web/macaron.go:163 (0x74e95dc)\nnet/http/server.go:3137 (0x624272d)\nnet/http/server.go:2039 (0x623da07)\nruntime/asm_amd64.s:1695 (0x5ee74c0)\n"

What you expected to happen: no error log from Grafana and I can render the image

How to reproduce it (as minimally and precisely as possible):

  1. clone the latest code,
  2. cd devenv/docker/simple
  3. docker-compose up

Anything else we need to know?: I used the similar config on my production server but I was using systemd to start grafana and render, I got the same errors as described above and additional I got error log from render service: Failed to get browser version my service file: [Service] Environment=BROWSER_TZ=Europe/Stockholm Environment=ENABLE_METRICS=true Environment=HTTP_HOST=0.0.0.0 Environment=HTTP_PORT=3010 Environment=RENDERING_CLUSTERING_MAX_CONCURRENCY=3 Environment=RENDERING_CLUSTERING_MODE=browser Environment=RENDERING_MODE=clustered Environment=RENDERING_DUMPIO=true Environment=LOG_LEVEL=debug ExecStart=/opt/grafana-image-renderer-3.11.1/grafana-image-renderer-3.11.1 server

Environment: (just for my production server)

koelle25 commented 1 month ago

Duplicate of #545

mousimin commented 1 month ago

Hi @koelle25 , I tried v3.11.0, and I got the same error: grafana-1 | logger=context userId=1 orgId=1 uname=admin t=2024-07-20T14:10:03.090812432Z level=error msg="Request error" error="Context.HTML - Error rendering template: error. You may need to build frontend assets \n template: error:16:42: executing \"error\" at <.Assets.Dark>: can't evaluate field Assets in type struct { Title string; AppTitle string; AppSubUrl string; ThemeType string; ErrorMsg error }" stack="github.com/grafana/grafana/pkg/web/context.go:112 (0x74e8064)\ngithub.com/grafana/grafana/pkg/services/contexthandler/model/model.go:54 (0x74f3328)\ngithub.com/grafana/grafana/pkg/api/render.go:106 (0xa44612a)\ngithub.com/grafana/grafana/pkg/api/response/web_hack.go:40 (0x74f94af)\nnet/http/server.go:2166 (0x74e90f8)\ngithub.com/grafana/grafana/pkg/web/macaron.go:131 (0x74e90b5)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/services/contexthandler/contexthandler.go:141 (0xa4505f4)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/render.go:44 (0x74e9c0b)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/macaron.go:137 (0x74e9194)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/middleware/csrf/csrf.go:66 (0x98f45af)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/middleware/recovery.go:180 (0xa428ffd)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/middleware/loggermw/logger.go:72 (0x98f553e)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/middleware/request_metrics.go:75 (0x82b19ed)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/middleware/request_tracing.go:88 (0xa429d75)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/middleware/requestmeta/request_metadata.go:66 (0xa44f6e1)\nnet/http/server.go:2166 (0x623f028)\ngithub.com/grafana/grafana/pkg/web/context.go:52 (0x74e79fa)\ngithub.com/grafana/grafana/pkg/web/router.go:155 (0x74eb3ed)\ngithub.com/grafana/grafana/pkg/web/router.go:221 (0x74ebf14)\ngithub.com/grafana/grafana/pkg/web/macaron.go:163 (0x74e95dc)\nnet/http/server.go:3137 (0x624272d)\nnet/http/server.go:2039 (0x623da07)\nruntime/asm_amd64.s:1695 (0x5ee74c0)\n"

Did you try the same? My steps:

  1. clone the latest code
  2. git checkout v3.11.0
  3. cd devenv/docker/simple
  4. change the version of image grafana-image-renderer from latest to 3.11.0
  5. docker-compose up
  6. login in Grafana, create a dashboard and click "Direct link rendered image"