opensearch-project / reporting

Export and automate PNG, PDF, and CSV reports in OpenSearch Dashboards
https://opensearch.org/docs/latest/dashboards/reporting/
Apache License 2.0
28 stars 65 forks source link

[BUG] Cannot create property '0' on number '1700813322772' when generating a CSV for a saved search #932

Closed baptistecdr closed 6 months ago

baptistecdr commented 9 months ago

What is the bug?

I created a saved search as follow:

Screenshot 2023-12-05 at 15 46 03

Time Window: Last 15 days Filter: product=product-type

And when I click on Reporting > Generate CSV, an exception is thrown in OpenSearch Dashboards:

{"type":"log","@timestamp":"2023-12-05T14:36:10Z","tags":["error","plugins","reportsDashboards"],"pid":1,"message":"TypeError: Cannot create property '0' on number '1700813322772'\n    at forEach (/usr/share/opensearch-dashboards/plugins/reportsDashboards/server/routes/utils/dataReportHelpers.ts:151:17)\n    at Array.forEach (<anonymous>)\n    at getOpenSearchData (/usr/share/opensearch-dashboards/plugins/reportsDashboards/server/routes/utils/dataReportHelpers.ts:150:30)\n    at convertOpenSearchDataToCsv (/usr/share/opensearch-dashboards/plugins/reportsDashboards/server/routes/utils/savedSearchReportHelper.ts:264:18)\n    at generateReportData (/usr/share/opensearch-dashboards/plugins/reportsDashboards/server/routes/utils/savedSearchReportHelper.ts:160:10)\n    at processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at createSavedSearchReport (/usr/share/opensearch-dashboards/plugins/reportsDashboards/server/routes/utils/savedSearchReportHelper.ts:42:16)\n    at createReport (/usr/share/opensearch-dashboards/plugins/reportsDashboards/server/routes/lib/createReport.ts:74:28)\n    at /usr/share/opensearch-dashboards/plugins/reportsDashboards/server/routes/report.ts:69:28\n    at Router.handle (/usr/share/opensearch-dashboards/src/core/server/http/router/router.js:201:44)\n    at handler (/usr/share/opensearch-dashboards/src/core/server/http/router/router.js:162:50)\n    at exports.Manager.execute (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/toolkit.js:60:28)\n    at Object.internals.handler (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/handler.js:46:20)\n    at exports.execute (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/handler.js:31:20)\n    at Request._lifecycle (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/request.js:371:32)\n    at Request._execute (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/request.js:281:9)"}

Extracted message: TypeError: Cannot create property '0' on number '1700813322772'

How can one reproduce the bug?

I created a local project with data so you can reproduce the bug. You can download the attached zip file.

Steps to reproduce the behavior:

  1. Run docker-compose up
  2. Run ./apply_index_templates.sh
  3. Run ./push_data.sh
  4. Create a Dashboard Index Pattern
    • name: indextest*
    • Time Field: event_date_time
  5. Display documents for the last 2 weeks
  6. Create a saved search with filter:
    • product: product-title
  7. Click on Reporting then Generate CSV
  8. See the error in OpenSearch container

What is the expected behavior? I expect to have my filtered data exported into CSV file.

What is your host/environment?

Do you have any screenshots? If applicable, add screenshots to help explain your problem.

Do you have any additional context?

opensearch-cannot-create-property.zip

rupal-bq commented 6 months ago

@baptistecdr Thanks for the details. I am able to reproduce the issue.

uncycler commented 6 months ago

Is this fix included in OS 2.12.0?

rupal-bq commented 6 months ago

Is this fix included in OS 2.12.0?

No. PR was merged after code freeze date. It will be included in v2.13.0.