From a8531e0a1359deddc21b44df38ebef724b7560f0 Mon Sep 17 00:00:00 2001 From: Anthony Delannoy Date: Thu, 2 Nov 2023 12:28:14 +0100 Subject: [PATCH] fix: default value if getBoundingClientRect undefined --- grafana_pdf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grafana_pdf.js b/grafana_pdf.js index e3cf5f2..15b15d8 100644 --- a/grafana_pdf.js +++ b/grafana_pdf.js @@ -58,7 +58,7 @@ const auth_header = 'Basic ' + new Buffer.from(auth_string).toString('base64'); // Get the height of the main canvas, and add a margin var height_px = await page.evaluate(() => { - return document.getElementsByClassName('react-grid-layout')[0].getBoundingClientRect().bottom; + return document.getElementsByClassName('react-grid-layout')[0].getBoundingClientRect?.().bottom || 540 ; }) + 20; //Francois: wait for page to be navigable (2min should be more than enough for longrange queries)