All Apps and Add-ons

Splunk JavaScript API- Why do I get an error when I try to use SDK to login remotely?

BryanK
New Member

 

 

const splunkjs = require('splunk-sdk');

const service = new splunkjs.Service({
    host: "xxxxxx",
    port: xxxx,
    username: "administrator",
    password: "xxxxxx",
    scheme: "https",
    version: "default"
}
);

const init = new splunkjs.Service
service.login(function(err, success) {
    if (err) {
        throw err;
    } else {
        console.log('Logged in successfully');
    }
}
);

 

 

 

 

Hey, 
I was trying to use the SDK to login remotely however the server keeps returning an error message as shown below. I even tried using postman on the local splunk server but it gives the same error as well. 

 

 

{
  response: { headers: {}, statusCode: 600 },
  status: 600,
  data: undefined,
  error: Error: write EPROTO 22680:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:332:
  
      at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16) {
    errno: -4046,
    code: 'EPROTO',
    syscall: 'write'
  }
}

 

 

  

However on the local server I am able to login just fine with the code shown below however I really don't want to do development on the splunk server directly as its quite a pain

 

 

const service = new splunkjs.Service({
    username: "xxx",
    password: "xxx"
}
);

 

 

 

Labels (2)
0 Karma
Get Updates on the Splunk Community!

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Index This | What goes away as soon as you talk about it?

May 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...

What's New in Splunk Observability Cloud and Splunk AppDynamics - May 2025

This month, we’re delivering several new innovations in Splunk Observability Cloud and Splunk AppDynamics ...