# /\_security/api\_key timeout

**URL:** https://discuss.elastic.co/t/security-api-key-timeout/351366
**Category:** Kibana
**Tags:** elastic-stack-security
**Created:** [January 18, 2024, 3:34pm UTC](https://discuss.elastic.co/t/security-api-key-timeout/351366 "2024-01-18T15:34:23Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![seism0saurus](https://avatars.discourse-cdn.com/v4/letter/s/a88e57/32.png) [@seism0saurus](https://discuss.elastic.co/u/seism0saurus)
#### Post date: [January 18, 2024, 3:34pm UTC](https://discuss.elastic.co/t/security-api-key-timeout/351366/1 "2024-01-18T15:34:23Z")

</div>

Hi,  
I encounter a problem with the API key management in Kibana.  
The page behind Stack Management -\> Security -\> API keys does not load. After some time it displays "Could not load API keys."  
Under technical details is a "proxy error".  
I tried to directly call the API endpoint /\_security/api\_key in the developer console but get this response:

```auto
{
  "statusCode": 502,
  "error": "Bad Gateway",
  "message": "Client request timeout"
}

```

When I search in the Kibana logfiles I only find one mention of api\_key:

```auto
 grep -e "api_key" /var/log/kibana/kibana.log 

{"service":{"node":{"roles":["background_tasks","ui"]}},"ecs":{"version":"8.6.1"},"@timestamp":"2024-01-18T05:17:30.983+01:00","message":"Failed to mark Task alerts_invalidate_api_keys \"Alerts-alerts_invalidate_api_keys\" as running: Request timed out","log":{"level":"ERROR","logger":"plugins.taskManager"},"process":{"pid":23200},"trace":{"id":"20fb114172fcef1bf344bc14f8f1dd25"},"transaction":{"id":"092958f692f4f72b"}}

```

It is some time ago I was on the API key page so I can't tell the version, it broke. Currently we run 8.12.0.

Has anyone an idea, what's going wrong?

---

<div class="post-metadata">

### Author: ![seism0saurus](https://avatars.discourse-cdn.com/v4/letter/s/a88e57/32.png) [@seism0saurus](https://discuss.elastic.co/u/seism0saurus)
#### Post date: [January 19, 2024, 3:05pm UTC](https://discuss.elastic.co/t/security-api-key-timeout/351366/2 "2024-01-19T15:05:39Z")

</div>

One more piece of information. If I try to make a direct call to the API with curl and not through the developer console I get an empty reply:

```auto
curl -u "secret_user:secret_password" https://my_elastic_server:5601/_security/api_key
curl: (52) Empty reply from server

```

---

<div class="post-metadata">

### Author: ![seism0saurus](https://avatars.discourse-cdn.com/v4/letter/s/a88e57/32.png) [@seism0saurus](https://discuss.elastic.co/u/seism0saurus)
#### Post date: [January 22, 2024, 12:50pm UTC](https://discuss.elastic.co/t/security-api-key-timeout/351366/3 "2024-01-22T12:50:15Z")

</div>

I have increased the timeout for calls from Kibana to Elasticsearch to 120 seconds instead of the default (30).

Now calling `GET /_security/api_key` in the developer console results in this error:

```auto
{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "RecyclerBytesStreamOutput cannot hold more than 2GB of data"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "RecyclerBytesStreamOutput cannot hold more than 2GB of data",
    "suppressed": [
      {
        "type": "illegal_state_exception",
        "reason": "Failed to close the XContentBuilder",
        "caused_by": {
          "type": "i_o_exception",
          "reason": "Unclosed object or array found"
        }
      }
    ]
  },
  "status": 400
}

```

There are many such errors in search engines. I'm trying to figure out, what the cause could be. I only want to load the API keys. That should never generate 2 GB of data.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [February 19, 2024, 12:50pm UTC](https://discuss.elastic.co/t/security-api-key-timeout/351366/4 "2024-02-19T12:50:36Z")

</div>

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