Hello,
I am using the splunk-utils SDK to try and search Splunk 9.0.4 from an external app. I am able to submit an initial search with a bearer token and can see my local instance receiving it and returning a search SID. However, when I try to retrieve the results with getData, I get an error saying "Invalid Version: undefined"
// https://splunkui.splunk.com/Packages/splunk-utils/Search
const n = await getData(
sid,
"results",
{ output_mode: "json_cols" },
{ splunkdPath: serverURL, app: "myapp", owner: "nobody"},
headers
)
Tracing the node_modules, I can see that the getData in search.js is trying to figure out the version, but I am not following how. This seems to be the line that is determining if v2 should be used:
// Use V2 endpoints only where available
// https://docs.splunk.com/Documentation/Splunk/latest/RESTREF/RESTsearch#Semantic_API_versioning
var V2_ENDPOINTS = ['results', 'results_preview', 'events'];
var endpointVersion = V2_ENDPOINTS.includes(endpoint) && gteSplunkVersion(_config.versionLabel, '9.0.2', '9.0.2209') ? '/v2' : '';
I have been looking at this example from @ryanoconnor and @nhaq but am not seeing how the right API version is being determined. https://github.com/splunk/react_search_example/blob/main/src/App.js
Any ideas how to update my call to tell my getData what version to use? I am assuming this is unhappy about a missing version but maybe it's something else... Full Error:
index.js:1 TypeError: Invalid Version: undefined
at new SemVer (semver.js:19:1)
at patch (patch.js:2:1)
at gteSplunkVersion (search.js:53:1)
at getData (search.js:326:1)
at loadResults (splunksearch.js:80:1)
at retrieveJob (splunksearch.js:56:1)
... View more