Git Product home page Git Product logo

Comments (9)

marefr avatar marefr commented on September 17, 2024 3

@ekapratama93 just published 1.0.7 of the plugin which had a bug regarding ignore of https errors. We've verified it works if Grafana runs with https/self signed certificates.

from grafana-image-renderer.

marefr avatar marefr commented on September 17, 2024 1

Anyone interested in testing if adding ignoreHTTPSErrors: true resolves this problem, rebuild and test? Code in question:

if ((process as any).pkg) {
const parts = puppeteer.executablePath().split(path.sep);
while (!parts[0].startsWith('chrome-')) {
parts.shift();
}
const executablePath = [path.dirname(process.execPath), ...parts].join(path.sep);
console.log('executablePath', executablePath);
browser = await puppeteer.launch({
executablePath,
env: env,
args: ['--no-sandbox'],
});
} else {
if (env['CHROME_BIN']) {
browser = await puppeteer.launch({
executablePath: env['CHROME_BIN'],
env: env,
args: ['--no-sandbox'],
});
} else {
browser = await puppeteer.launch({
env: env,
args: ['--no-sandbox'],
});
}
}

Suggested changes:

diff --git a/src/browser.ts b/src/browser.ts
index 187d832..90e5c66 100644
--- a/src/browser.ts
+++ b/src/browser.ts
@@ -42,6 +42,7 @@ export class Browser {
         browser = await puppeteer.launch({
           executablePath,
           env: env,
+          ignoreHTTPSErrors: true,
           args: ['--no-sandbox'],
         });
       } else {
@@ -49,11 +50,13 @@ export class Browser {
           browser = await puppeteer.launch({
             executablePath: env['CHROME_BIN'],
             env: env,
+            ignoreHTTPSErrors: true,
             args: ['--no-sandbox'],
           });
         } else {
           browser = await puppeteer.launch({
             env: env,
+            ignoreHTTPSErrors: true,
             args: ['--no-sandbox'],
           });
         }

from grafana-image-renderer.

kaffarell avatar kaffarell commented on September 17, 2024 1

Ok, figured it out literally minutes after posting the comment. For anyone having the same problem, set the IGNORE_HTTPS_ERRORS=true environment variable in the renderer and not in grafana.

from grafana-image-renderer.

marefr avatar marefr commented on September 17, 2024

Guess this is related to puppeteer/puppeteer#540

from grafana-image-renderer.

crazy-canux avatar crazy-canux commented on September 17, 2024

I got the same issue.
grafana use https, renderer use http.

monitor_grafana-service.1.l9og2p9i456e@ubuntu1 | 2019/11/02 09:47:28 http: TLS handshake error from 10.255.0.2:59292: remote error: tls: unknown certificate
monitor_grafana-service.1.l9og2p9i456e@ubuntu1 | 2019/11/02 09:47:28 http: TLS handshake error from 10.255.0.2:59293: remote error: tls: unknown certificate
monitor_grafana-service.1.l9og2p9i456e@ubuntu1 | t=2019-11-02T09:47:28+0000 lvl=eror msg="Failed to look up user based on cookie" logger=context error="user token not found"
monitor_grafana-service.1.l9og2p9i456e@ubuntu1 | 2019/11/02 09:47:28 http: TLS handshake error from 10.255.0.2:59295: remote error: tls: unknown certificate
monitor_grafana-service.1.l9og2p9i456e@ubuntu1 | 2019/11/02 09:47:28 http: TLS handshake error from 10.255.0.2:59296: remote error: tls: unknown certificate
monitor_grafana-service.1.l9og2p9i456e@ubuntu1 | 2019/11/02 09:47:28 http: TLS handshake error from 10.255.0.2:59297: remote error: tls: unknown certificate
monitor_grafana-service.1.l9og2p9i456e@ubuntu1 | 2019/11/02 09:47:28 http: TLS handshake error from 10.255.0.2:59299: remote error: tls: unknown certificate
monitor_grafana-service.1.l9og2p9i456e@ubuntu1 | 2019/11/02 09:47:28 http: TLS handshake error from 10.255.0.2:59298: remote error: tls: unknown certificate
monitor_grafana-service.1.l9og2p9i456e@ubuntu1 | t=2019-11-02T09:47:46+0000 lvl=info msg="Successful Login" logger=http.server User=sandbox@localhost
monitor_grafana-service.1.l9og2p9i456e@ubuntu1 | 2019/11/02 09:49:01 http: TLS handshake error from 172.12.0.3:54474: remote error: tls: unknown certificate
monitor_grafana-service.1.l9og2p9i456e@ubuntu1 | t=2019-11-02T09:49:01+0000 lvl=eror msg="Remote rendering request failed" logger=rendering error="500 Internal Server Error"
monitor_grafana-service.1.l9og2p9i456e@ubuntu1 | t=2019-11-02T09:49:01+0000 lvl=eror msg="Rendering failed." logger=context userId=1 orgId=1 uname=sandbox error="Remote rendering request failed. 500: 500 Internal Server Error"
monitor_grafana-service.1.l9og2p9i456e@ubuntu1 | t=2019-11-02T09:49:01+0000 lvl=eror msg="Request Completed" logger=context userId=1 orgId=1 uname=sandbox method=GET path=/render/d-solo/e5Ef8jkmz/system status=500 remote_addr=10.255.0.2 time_ms=1990 size=1722 referer="https://10.103.238.31:3000/d/e5Ef8jkmz/system?orgId=1"

Did you fix it?

from grafana-image-renderer.

kjetilmjos avatar kjetilmjos commented on September 17, 2024

My fix was to not use https and have http with a proxy in front to terminate ssl.

from grafana-image-renderer.

marefr avatar marefr commented on September 17, 2024

Merged my suggested fix above. When version 1.0.6 is released please try it out using the new environment variable, see readme. Please report here if it still doesn't work.

from grafana-image-renderer.

ekapratama93 avatar ekapratama93 commented on September 17, 2024

@marefr I add GF_RENDERER_PLUGIN_IGNORE_HTTPS_ERRORS=true to /etc/default/grafana-server and restart the grafana-server and get t=2019-11-29T22:55:39+0700 lvl=info msg="Renderer plugin started" logger=rendering chromeBin=/var/lib/grafana/plugins/grafana-image-renderer/chrome-linux/chrome ignoreHttpsErrors=true timestamp=0001-01-01T00:00:00.000Z in the log file.

But I still get error :

t=2019-11-29T23:07:12+0700 lvl=dbug msg="Render request received" logger=rendering url="https://localhost:3000/d-solo/000000011/alert?orgId=1&panelId=42&render=1" timestamp=0001-01-01T00:00:00.000Z
t=2019-11-29T23:07:12+0700 lvl=eror msg="Render request failed" logger=rendering url="https://localhost:3000/d-solo/000000011/alert?orgId=1&panelId=42&render=1" error=map[] timestamp=0001-01-01T00:00:00.000Z
t=2019-11-29T23:07:12+0700 lvl=eror msg="Failed to upload alert panel image." logger=alerting.notifier error="Rendering failed: Error: net::ERR_CERT_COMMON_NAME_INVALID at https://localhost:3000/d-solo/000000011/alert?orgId=1&panelId=42&render=1"

Here is the output of grafana-cli plugins ls

installed plugins:
grafana-image-renderer @ 1.0.6
grafana-worldmap-panel @ 0.2.1

from grafana-image-renderer.

kaffarell avatar kaffarell commented on September 17, 2024

Hey, this still doesn't work. We have a grafana server with https and our certificates installed. The renderer is in the same network and uses http. We get errors like this from grafana:

server.go:3230: http: TLS handshake error from 10.42.0.177:40194: remote error: tls: unknown certificate

and these errors in the image-renderer:

{"level":"info","message":"HTTP Server started, listening at http://localhost:8081"}
{"failure":"net::ERR_CERT_COMMON_NAME_INVALID","level":"error","message":"Browser request failed","method":"GET","url":"https://10.43.10.35:3000/d-solo/HVlpjkBWz/dashboard?orgId=1&refresh=5m&from=1637242577549&to=1668778577549&panelId=5&width=1000&height=500&tz=Europe%2FRome&render=1"}
{"err":"Error: net::ERR_CERT_COMMON_NAME_INVALID at https://10.43.10.35:3000/d-solo/HVlpjkBWz/dashboard?orgId=1&refresh=5m&from=1637242577549&to=1668778577549&panelId=5&width=1000&height=500&tz=Europe%2FRome&render=1\n    at navigate (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:156:23)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at async FrameManager.navigateFrame (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:131:21)\n    at async Frame.goto (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:512:16)\n    at async Page.goto (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:1167:16)\n    at async Browser.takeScreenshot (/usr/src/app/build/browser/browser.js:256:13)\n    at async Browser.render (/usr/src/app/build/browser/browser.js:230:20)\n    at async HttpServer.render (/usr/src/app/build/service/http-server.js:53:28)","level":"error","message":"Error while trying to prepare page for screenshot","url":"https://10.43.10.35:3000/d-solo/HVlpjkBWz/dashboard?orgId=1&refresh=5m&from=1637242577549&to=1668778577549&panelId=5&width=1000&height=500&tz=Europe%2FRome&render=1"}
{"err":"TimeoutError: waiting for function failed: timeout 60000ms exceeded\n    at new WaitTask (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:528:34)\n    at DOMWorld.waitForFunction (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:479:26)\n    at Frame.waitForFunction (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:1010:32)\n    at Page.waitForFunction (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:2490:33)\n    at /usr/src/app/build/browser/browser.js:284:29\n    at Browser.withTimingMetrics (/usr/src/app/build/browser/browser.js:411:20)\n    at Browser.takeScreenshot (/usr/src/app/build/browser/browser.js:280:24)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at async Browser.render (/usr/src/app/build/browser/browser.js:230:20)\n    at async HttpServer.render (/usr/src/app/build/service/http-server.js:53:28)","level":"error","message":"Error while waiting for the panels to load","url":"https://10.43.10.35:3000/d-solo/HVlpjkBWz/dashboard?orgId=1&refresh=5m&from=1637242577549&to=1668778577549&panelId=5&width=1000&height=500&tz=Europe%2FRome&render=1"}

from grafana-image-renderer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.