How to load report data from Url while using puppeteer

Answered
loveena asked on August 31, 2021

I am using puppeteer in my flexmonster module. When i am using

setReport({
dataSource: {
filename:'https://cdn.flexmonster.com/data/data.json'
}
});

Report is loading fine and also image is exporting with data. But.
When i am trying to load report from URL,

{
"dataSource": {
"type":"api",
"url":"",
"index":"",
"requestHeaders":
{
"Authorization":"Basic TOKEN"
},
"withCredentials":true
},
,
"version":"2.9.6",
"creationDate":"2021-08-31T08:03:45.624Z"
}
Then no report is loading and also image is creating empty.

Please suggest

 

3 answers

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster September 1, 2021

Hello,
 
Thank you for posting on our forum.
 
We recommend making sure the specified API endpoint is reachable from the browser. Create Flexmonster instance in a sample page without using puppeteer and apply the same report to see if any errors occur. In case any alerts, warnings, or console exceptions arise, please send us corresponding screenshots.
 
Looking forward to hearing from you.
 
Kind regards,
Illia

Public
loveena September 2, 2021

Hello
The flexmonster reports are loading fine on other pages but not in puppeteer if we use same reports.
Please suggest us some Js fiddle examples to export the data and image of flexmonster report loading from the API url while using puppeteer .
Thanks

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster September 3, 2021

Hello,
 
Thank you for checking the connection to your data source outside the puppeteer project.
 
We recommend making sure that the Slice Object is defined in your reports. It should contain rows, columns, and measures properties in order to be correctly displayed. Otherwise, Flexmonster will not show the grid with the default slice configuration. Instead, it will open the Field List allowing the user to choose fields to display. In this case, empty export files may be generated.
 
You can check the component's behavior by setting the headless parameter of the launch method to false: const browser = await puppeteer.launch({ headless: false });.
 
Please let us know if it helps.
 
Kind regards,
Illia

Please login or Register to Submit Answer