We're trying to setup a Watcher job that will call a Dashboard POST URL to generate a PDF on a regular interval via a webhook. This report is then stored in Elasticsearch and downloadable by support users.
We appear to be fairly close but are receiving the following error when Watcher (from Elasticsearch) calls the generate report API endpoint (in Kibana):
Debug: internal, implementation, error
TypeError: Cannot read property 'showLinks' of undefined
at licensePreRouting (/usr/share/kibana/x-pack/legacy/plugins/reporting/server/routes/lib/reporting_feature_pre_routing.js:27:29)
at module.exports.internals.Manager.execute (/usr/share/kibana/node_modules/hapi/lib/toolkit.js:35:106)
at Object.internals.handler (/usr/share/kibana/node_modules/hapi/lib/handler.js:50:48)
at exports.execute (/usr/share/kibana/node_modules/hapi/lib/handler.js:21:37)
at process._tickCallback (internal/process/next_tick.js:68:7)
We have simply copied the URL given to us by the Kibana Dashboard (via the Share > PDF > Copy POST URL menu) into the Watcher job spec, added a user auth (who is a member of the reporting_user role and has access to the space in which the dashboard sits with Read access for the Dashboard).
The Watcher webhook event is definitely hitting the Kibana instance and appears to be trying to generate the report, but then fails with the above - confusingly tagged as a Debug statement, but appear to be an error, which is then repeated in the below log message:
{"type":"error","@timestamp":"2020-05-25T13:41:04Z","tags":[],"pid":110,"level":"error","error":{"message":"Cannot read property 'showLinks' of undefined","name":"TypeError","stack":"TypeError: Cannot read property 'showLinks' of undefined\n at licensePreRouting (/usr/share/kibana/x-pack/legacy/plugins/reporting/server/routes/lib/reporting_feature_pre_routing.js:27:29)\n at module.exports.internals.Manager.execute (/usr/share/kibana/node_modules/hapi/lib/toolkit.js:35:106)\n at Object.internals.handler (/usr/share/kibana/node_modules/hapi/lib/handler.js:50:48)\n at exports.execute (/usr/share/kibana/node_modules/hapi/lib/handler.js:21:37)\n at process._tickCallback (internal/process/next_tick.js:68:7)"},"url":{"protocol":null,"slashes":null,"auth":null,"host":null,"port":null,"hostname":null,"hash":null,"search":null,"query":{},"pathname":"/api/reporting/generate/printablePdf%3FjobParams=(browserTimezone:Europe%2FLondon,layout:(id:print),objectType:dashboard,relativeUrls:!('%2Fs%2Fmi%2Fapp%2Fkibana%23%2Fdashboard%2F40c99430-3a3d-11ea-a0d3-837b95f9b7e4%3F_a=(description:!'!',filters:!!(),fullScreenMode:!!f,options:(hidePanelTitles:!!f,useMargins:!!t),panels:!!((embeddableConfig:(params:(sort:(columnIndex:4,direction:asc)),vis:(params:(sort:(columnIndex:4,direction:desc)))),gridData:(h:57,i:e8783343-e1a9-4864-a0ef-1397f735238b,w:24,x:0,y:0),id:de97ff90-3a41-11ea-a0d3-837b95f9b7e4,panelIndex:e8783343-e1a9-4864-a0ef-1397f735238b,type:visualization,version:!'7.7.0!'),(embeddableConfig:(legendOpen:!!t,vis:(legendOpen:!!f)),gridData:(h:16,i:f4af2d34-8216-4587-8e12-41c27ee837d9,w:23,x:24,y:0),id:!'7ffb7cc0-3a3f-11ea-a8d2-6db16e900dd7!',panelIndex:f4af2d34-8216-4587-8e12-41c27ee837d9,type:visualization,version:!'7.7.0!')),query:(language:kuery,query:!'!'),timeRestore:!!t,title:!'Upload%2520History!',viewMode:view)&_g=(filters:!!(),refreshInterval:(pause:!!t,value:0),time:(from:now-1w,to:now%252Fw))'),title:'Upload%20History')","path":"/api/reporting/generate/printablePdf%3FjobParams=(browserTimezone:Europe%2FLondon,layout:(id:print),objectType:dashboard,relativeUrls:!('%2Fs%2Fmi%2Fapp%2Fkibana%23%2Fdashboard%2F40c99430-3a3d-11ea-a0d3-837b95f9b7e4%3F_a=(description:!'!',filters:!!(),fullScreenMode:!!f,options:(hidePanelTitles:!!f,useMargins:!!t),panels:!!((embeddableConfig:(params:(sort:(columnIndex:4,direction:asc)),vis:(params:(sort:(columnIndex:4,direction:desc)))),gridData:(h:57,i:e8783343-e1a9-4864-a0ef-1397f735238b,w:24,x:0,y:0),id:de97ff90-3a41-11ea-a0d3-837b95f9b7e4,panelIndex:e8783343-e1a9-4864-a0ef-1397f735238b,type:visualization,version:!'7.7.0!'),(embeddableConfig:(legendOpen:!!t,vis:(legendOpen:!!f)),gridData:(h:16,i:f4af2d34-8216-4587-8e12-41c27ee837d9,w:23,x:24,y:0),id:!'7ffb7cc0-3a3f-11ea-a8d2-6db16e900dd7!',panelIndex:f4af2d34-8216-4587-8e12-41c27ee837d9,type:visualization,version:!'7.7.0!')),query:(language:kuery,query:!'!'),timeRestore:!!t,title:!'Upload%2520History!',viewMode:view)&_g=(filters:!!(),refreshInterval:(pause:!!t,value:0),time:(from:now-1w,to:now%252Fw))'),title:'Upload%20History')","href":"/api/reporting/generate/printablePdf%3FjobParams=(browserTimezone:Europe%2FLondon,layout:(id:print),objectType:dashboard,relativeUrls:!('%2Fs%2Fmi%2Fapp%2Fkibana%23%2Fdashboard%2F40c99430-3a3d-11ea-a0d3-837b95f9b7e4%3F_a=(description:!'!',filters:!!(),fullScreenMode:!!f,options:(hidePanelTitles:!!f,useMargins:!!t),panels:!!((embeddableConfig:(params:(sort:(columnIndex:4,direction:asc)),vis:(params:(sort:(columnIndex:4,direction:desc)))),gridData:(h:57,i:e8783343-e1a9-4864-a0ef-1397f735238b,w:24,x:0,y:0),id:de97ff90-3a41-11ea-a0d3-837b95f9b7e4,panelIndex:e8783343-e1a9-4864-a0ef-1397f735238b,type:visualization,version:!'7.7.0!'),(embeddableConfig:(legendOpen:!!t,vis:(legendOpen:!!f)),gridData:(h:16,i:f4af2d34-8216-4587-8e12-41c27ee837d9,w:23,x:24,y:0),id:!'7ffb7cc0-3a3f-11ea-a8d2-6db16e900dd7!',panelIndex:f4af2d34-8216-4587-8e12-41c27ee837d9,type:visualization,version:!'7.7.0!')),query:(language:kuery,query:!'!'),timeRestore:!!t,title:!'Upload%2520History!',viewMode:view)&_g=(filters:!!(),refreshInterval:(pause:!!t,value:0),time:(from:now-1w,to:now%252Fw))'),title:'Upload%20History')"},"message":"Cannot read property 'showLinks' of undefined"}
We've tried (temporarily) granting the user configured in the Watcher job the superuser role, all cluster permissions and also all access to all spaces... but that didn't seem to make any difference - the job keeps failing and this error keeps getting spat into the logs.
Any help, greatly appreciated.