<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: splunk-utils/search: GetData API Version undefined in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Fix-error-in-splunk-utils-search-GetData-API-Version-undefined/m-p/698703#M11693</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/201301"&gt;@ohbuckeyeio&lt;/a&gt;&amp;nbsp;, I'm just curious; did you ever get a response from Splunk on this? I'm finding other problems with my users of splunk-utils and wonder whether more recent versions are safe to use or not.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Sep 2024 18:31:19 GMT</pubDate>
    <dc:creator>pgoldweic</dc:creator>
    <dc:date>2024-09-10T18:31:19Z</dc:date>
    <item>
      <title>Fix error in splunk-utils/search: GetData API Version undefined?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Fix-error-in-splunk-utils-search-GetData-API-Version-undefined/m-p/630881#M10931</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;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"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;// 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
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&amp;nbsp; This seems to be the line that is determining if v2 should be used:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;  // 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) &amp;amp;&amp;amp; gteSplunkVersion(_config.versionLabel, '9.0.2', '9.0.2209') ? '/v2' : '';&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have been looking at this example from&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/216008"&gt;@ryanoconnor&lt;/a&gt;&amp;nbsp;and &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/240773"&gt;@nhaq&lt;/a&gt;&amp;nbsp;but am not seeing how the right API version is being determined.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://github.com/splunk/react_search_example/blob/main/src/App.js" target="_blank" rel="noopener"&gt;https://github.com/splunk/react_search_example/blob/main/src/App.js&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Any ideas how to update my call to tell my getData what version to use?&amp;nbsp; I am assuming this is unhappy about a missing version but maybe it's something else...&lt;BR /&gt;&lt;BR /&gt;Full Error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;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)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 15:35:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Fix-error-in-splunk-utils-search-GetData-API-Version-undefined/m-p/630881#M10931</guid>
      <dc:creator>ohbuckeyeio</dc:creator>
      <dc:date>2023-02-15T15:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: splunk-utils/search: GetData API Version undefined</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Fix-error-in-splunk-utils-search-GetData-API-Version-undefined/m-p/630906#M10934</link>
      <description>&lt;P&gt;Adding additional information.&lt;BR /&gt;&lt;BR /&gt;Looking further at the search.js's getData implementation, I might have a versioning issue happening with my splunk-utils package. The notes for getData suggest it is doing a GET:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;A href="https://splunkui.splunk.com/Packages/splunk-utils/Search" target="_blank" rel="noopener"&gt;https://splunkui.splunk.com/Packages/splunk-utils/Search&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;Makes a GET request to the&amp;nbsp;&lt;/SPAN&gt;search/${endpointVersion}/jobs/${search_id}/${endpoint}&lt;SPAN&gt;&amp;nbsp;REST API endpoint to get data from the specified search job.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;My version of the package is doing a POST. These changes appear to have been pushed in the last few weeks according to the change log.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;  if (parameters.search &amp;amp;&amp;amp; endpointVersion === '/v2') {
    return fetch(url, _objectSpread(_objectSpread({}, baseFetchInit), {}, {
      method: 'POST',
      body: qs
    })).then((0, _fetch.handleResponse)([200, 204]))["catch"]((0, _fetch.handleError)("Failed to get ".concat(endpoint || 'status', " for job ").concat(sid)));
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 05:18:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Fix-error-in-splunk-utils-search-GetData-API-Version-undefined/m-p/630906#M10934</guid>
      <dc:creator>ohbuckeyeio</dc:creator>
      <dc:date>2023-02-15T05:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: splunk-utils/search: GetData API Version undefined</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Fix-error-in-splunk-utils-search-GetData-API-Version-undefined/m-p/630909#M10935</link>
      <description>&lt;P&gt;Sure enough, downgrading to version 2.2.4 fixed my issue.&amp;nbsp; There must be something fundamentally different with the latest 2.3.1 version that is not playing well with an externally-based application calling Splunk.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;npm install &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/149"&gt;@splunk&lt;/a&gt;/splunk-utils@"2.2.4" &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;The 2.3.1 version appears to be reliant on the Config package, but running outside of a Splunk environment, I do not see how it is possible to gather those facts and the documentation on this endpoint is lacking.&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;A href="https://splunkui.splunk.com/Packages/splunk-utils/Config" target="_blank"&gt;https://splunkui.splunk.com/Packages/splunk-utils/Config&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Does the 2.3.1 version of getData require a cookie instead of a bearer token in a header? What am I missing?&amp;nbsp; I might need to move this to a case with Splunk.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 05:34:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Fix-error-in-splunk-utils-search-GetData-API-Version-undefined/m-p/630909#M10935</guid>
      <dc:creator>ohbuckeyeio</dc:creator>
      <dc:date>2023-02-15T05:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: splunk-utils/search: GetData API Version undefined</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Fix-error-in-splunk-utils-search-GetData-API-Version-undefined/m-p/698703#M11693</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/201301"&gt;@ohbuckeyeio&lt;/a&gt;&amp;nbsp;, I'm just curious; did you ever get a response from Splunk on this? I'm finding other problems with my users of splunk-utils and wonder whether more recent versions are safe to use or not.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2024 18:31:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Fix-error-in-splunk-utils-search-GetData-API-Version-undefined/m-p/698703#M11693</guid>
      <dc:creator>pgoldweic</dc:creator>
      <dc:date>2024-09-10T18:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: splunk-utils/search: GetData API Version undefined</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Fix-error-in-splunk-utils-search-GetData-API-Version-undefined/m-p/698705#M11694</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/201301"&gt;@ohbuckeyeio&lt;/a&gt;&amp;nbsp;, I'm just curious; did you ever get a response from Splunk on this? I'm finding other problems with my users of splunk-utils and wonder whether more recent versions are safe to use or not.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2024 18:39:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Fix-error-in-splunk-utils-search-GetData-API-Version-undefined/m-p/698705#M11694</guid>
      <dc:creator>pgoldweic</dc:creator>
      <dc:date>2024-09-10T18:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: splunk-utils/search: GetData API Version undefined</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Fix-error-in-splunk-utils-search-GetData-API-Version-undefined/m-p/698706#M11695</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/175056"&gt;@pgoldweic&lt;/a&gt;&amp;nbsp;- I did not receive a response back. I was told to email the dev team's support directly:&lt;/P&gt;&lt;P&gt;&lt;A class="" href="mailto:webplatform@splunk.com" target="_blank" rel="noopener"&gt;webplatform@splunk.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;or hit up their Slack channel:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="" href="https://splunk-usergroups.slack.com/archives/C01CYF27FSS" target="_blank" rel="noopener"&gt;#webplatform&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2024 18:43:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Fix-error-in-splunk-utils-search-GetData-API-Version-undefined/m-p/698706#M11695</guid>
      <dc:creator>ohbuckeyeio</dc:creator>
      <dc:date>2024-09-10T18:43:21Z</dc:date>
    </item>
  </channel>
</rss>

