Error when using `callWithInternalUser` instead of `callWithRequest`

Rererence : https://www.elastic.co/blog/kibana-plugin-developers-meet-elasticsearch-clusters

When using callWithInternalUser instead of callWithRequest i got this error
Can someone tell me why this error and how we can fix it ?

Debug: internal, implementation, error
    TypeError: endpoint.split is not a function
    at split (C:\kibana_dev\kibana\src\core\server\elasticsearch/cluster_client.ts:73:31)
    at ClusterClient.callAPI [as callAsInternalUser] (C:\kibana_dev\kibana\src\core\server\elasticsearch/cluster_client.ts:155:18)
    at Cluster.callAsInternalUser [as callWithInternalUser] (C:\kibana_dev\kibana\src\legacy\core_plugins\elasticsearch\lib/cluster.ts:45:37)
    at callWithInternalUser (C:\kibana_dev\kibana\plugins\s-one-case-management\server\routes/cases.js:51:40)
    at module.exports.internals.Manager.execute (C:\kibana_dev\kibana\node_modules\hapi\lib\toolkit.js:35:106)
    at Object.internals.handler (C:\kibana_dev\kibana\node_modules\hapi\lib\handler.js:50:48)
    at exports.execute (C:\kibana_dev\kibana\node_modules\hapi\lib\handler.js:35:36)
    at Request._lifecycle (C:\kibana_dev\kibana\node_modules\hapi\lib

Hey @ylasri, when using callWithRequest the first parameter is the Hapi Request object:

await callWithRequest(req, 'search', query)

where-as, when using callWithInternalUser this isn't required:

callWithInternalUser('search', query)

Thank You @Brandon_Kobel

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.