All Apps and Add-ons

How do we resolve the issues with javascript sdk

Engager

Hi All,

We are new to splunk. We are trying to develop splunk app with javascript sdk. We are facing issues in running examples which are available in side sdk. we had installed splunk 6.0 and node.js.
We are getting errors in search app. Error in listing apps. could any one can provide us the directions in order to resolve the issue. Thanks in advance.Below is the code

var http = new splunkjs.ProxyHttp("/proxy");
3.

4. var service = new splunkjs.Service(http, {
5. username: username,
6. password: password,
7. scheme: scheme,
8. host: host,
9. port: port,
10. version: version
11. });
12.
13. // First, we log in
14. service.login(function(err, success){
15. // We check for both errors in the connection as well- as if the login itself failed.
16. if (err || !success) {
17. console.log("Error in logging");
18. done(err || "Login failed");
19. return;
20. }
21.

22. // Now that we're logged in, let's get a listing of all the apps.
23. service.apps().fetch(function(err, apps){
24.

25.

26.

27. if (err){
28. console.log("There was an error retrieving the list of applications:", err);
29. alert("This is the error...", err);
30. done(err);
31. return;
32. }
33.
34.

35. var appsList = apps.list();
36. alert(" This is the length of apps..."+appsList.length);
37.

38. console.log("Applications:");
39. for(var i = 0; i < appsList.length; i++){
40. var app = appsList[i];
41. console.log(" App " + i + ": " + app.name);
42. }
43. done();
44. });
45. });
46.

Best Regards,
Siva Rama Prasad.G

Splunk Employee
Splunk Employee

Hi Siva

Update: This has now been fixed in our SDK and is live if you download from dev.splunk.com.

Sorry you ran into problems. There is a known bug in the javascript SDK with Splunk 6.0 which causes our samples to fail. This has been fixed now in our "develop" branch on our github repo. If you checkout the develop branch OR download it directly here you should see that all samples will work.

Let us know if this fixes your problem!

Regards
Glenn

Splunk Employee
Splunk Employee

Great to hear Siva. We went ahead and pushed out the SDK version 1.2.2 with this fix. Let us know if you run into any more issues!

0 Karma

Engager

Hi Glenn,

The samples are working fine. We appreciate your help.

Best Regards,
Siva Rama Prasad.G

0 Karma