Can't generate report in PDF/PNG, using reverse proxy(nginx, server.basePath)

It seems like generating an ‘on-demand’ report in PDF/PNG format is not working out-of-the-box when using a reverse proxy server (in my case nginx).
(export to CSV working fine)

OpenSearch version: 2.1.0
OpenSearch Dashboards 2.1.0
(also a combination of OS: 1.3.1 and OSD 1.2.0 is not working as tried initially)

I have an OpenSearch running behind nginx reverse proxy server. ‘server.basePath’ variable has been set up in a docker-compose file to ‘/opensearch’.

Steps to reproduce the issue:

  1. Open OpenSearch-Dashboards tool
  2. Open one of the previously saved dashboards
  3. Click on Reporting link, and then on ‘Download PDF’
    image

Expected result:

  • the browser downloads PDF report file

Results:

  • showing pop-up ‘Generating report’, and this task never finishes
  • action job is visible in Reporting list, but I couldn’t download the report file from that link too
    image

Docker-compose part for OpenSearch Dashboards:
(make it as simple as possible for debug)

...
opensearch-dashboard:
    image: opensearchproject/opensearch-dashboards:2.1.0
    environment:
      - "SERVER_BASEPATH=/opensearch"
      - "DISABLE_SECURITY_DASHBOARDS_PLUGIN=true"
      - "OPENSEARCH_HOSTS=http://opensearch:9200"
    networks:
      - managementSystemNet
...

Logs from OpenSearch Dashboards container:

{"type":"log","@timestamp":"2022-07-15T08:58:24Z","tags":["error","plugins","reportsDashboards"],"pid":1,"message":"Failed to generate report: TimeoutError: waiting for selector \"#dashboardViewport\" failed: timeout 100000ms exceeded"}

{"type":"log","@timestamp":"2022-07-15T08:58:24Z","tags":["error","plugins","reportsDashboards"],"pid":1,"message":"{ TimeoutError: waiting for selector \"#dashboardViewport\" failed: timeout 100000ms exceeded\n    at new WaitTask (/usr/share/opensearch-dashboards/plugins/reportsDashboards/node_modules/puppeteer-core/lib/DOMWorld.js:549:28)\n    at DOMWorld._waitForSelectorOrXPath (/usr/share/opensearch-dashboards/plugins/reportsDashboards/node_modules/puppeteer-core/lib/DOMWorld.js:478:22)\n    at DOMWorld.waitForSelector (/usr/share/opensearch-dashboards/plugins/reportsDashboards/node_modules/puppeteer-core/lib/DOMWorld.js:432:17)\n    at Frame.waitForSelector (/usr/share/opensearch-dashboards/plugins/reportsDashboards/node_modules/puppeteer-core/lib/FrameManager.js:627:47)\n    at Frame.<anonymous> (/usr/share/opensearch-dashboards/plugins/reportsDashboards/node_modules/puppeteer-core/lib/helper.js:112:23)\n    at Page.waitForSelector (/usr/share/opensearch-dashboards/plugins/reportsDashboards/node_modules/puppeteer-core/lib/Page.js:1095:29)\n    at createVisualReport (/usr/share/opensearch-dashboards/plugins/reportsDashboards/server/routes/utils/visual_report/visualReportHelper.ts:130:18) name: 'TimeoutError' }"}

{"type":"error","@timestamp":"2022-07-15T08:56:39Z","tags":[],"pid":1,"level":"error","error":{"message":"Internal Server Error","name":"Error","stack":"Error: Internal Server Error\n    at HapiResponseAdapter.toError (/usr/share/opensearch-dashboards/src/core/server/http/router/response_adapter.js:145:19)\n    at HapiResponseAdapter.toHapiResponse (/usr/share/opensearch-dashboards/src/core/server/http/router/response_adapter.js:99:19)\n    at HapiResponseAdapter.handle (/usr/share/opensearch-dashboards/src/core/server/http/router/response_adapter.js:94:17)\n    at Router.handle (/usr/share/opensearch-dashboards/src/core/server/http/router/router.js:164:34)"},"url":{"protocol":null,"slashes":null,"auth":null,"host":null,"port":null,"hostname":null,"hash":null,"search":"?timezone=Europe%2FBelgrade&dateFormat=MMM+D%2C+YYYY+%40+HH%3Amm%3Ass.SSS&csvSeparator=%2C","query":{"timezone":"Europe/Belgrade","dateFormat":"MMM D, YYYY @ HH:mm:ss.SSS","csvSeparator":","},"pathname":"/api/reporting/generateReport","path":"/api/reporting/generateReport?timezone=Europe%2FBelgrade&dateFormat=MMM+D%2C+YYYY+%40+HH%3Amm%3Ass.SSS&csvSeparator=%2C","href":"/api/reporting/generateReport?timezone=Europe%2FBelgrade&dateFormat=MMM+D%2C+YYYY+%40+HH%3Amm%3Ass.SSS&csvSeparator=%2C"},"message":"Internal Server Error"}

P.S. I saw a lot of issues regarding this topic, like this one, but couldn’t find the solution.

Thank you for your support in advance.

Cheers,
Damjan

Any idea? It seems like you can’t generate report in PDF or PNG if reverse proxy is used… :frowning:

Is there any workaround for this?

Hi, after 2.5.0 the reporting plugin is using browser to generate the report, so it should work through reverse proxy

1 Like

Thanks for info! Great to hear that.
Not able to try it at this stage of my project, but will confirm when I do.
Cheers