Javascript Client security.getRole returning invalid JSON

We are experiencing a strange issue with the javascript client. When calling client.security.getRole() we're seeing JSON formatted result like below:

await this.client.security.getRole({name: 'test-role-2'})
                .then(res => {
                  var result=res.body;
                    console.log(res.body);
                   
                    })
                .catch(error => {
                  console.log(error);
                 
                });

{ 'test-role-2':
   { cluster: [],
     indices: [],
     applications: [],
     run_as: [ 'baldy' ],
     metadata: {},
     transient_metadata: { enabled: true } } }

The problem is the single-quoted key for the role name. JSON keys should be double-quoted, or have no quotes.

When executing the following get command in Kibana, the role returns correctly.

GET _security/role/test-role-2

{
  "test-role-2" : {
    "cluster" : [ ],
    "indices" : [ ],
    "applications" : [ ],
    "run_as" : [
      "baldy"
    ],
    "metadata" : { },
    "transient_metadata" : {
      "enabled" : true
    }
  }
}

This behavior only seems to occur on roles we create. The existing system roles return correctly through the client security.getRole().

We've tried creating though the Kibana management screens, Posting to the elasticsearch api directly, using a rest client, and using the javascript client, to no avail.

Does anyone know why this might be happening?

Thank you,

Matt

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