# \[apm-reporter\] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Error sending data to APM server: cannot retry due to server authentication, in streaming mode, response code is 401

**URL:** <https://discuss.elastic.co/t/apm-reporter-error-co-elastic-apm-agent-report-intakev2reportingeventhandler-error-sending-data-to-apm-server-cannot-retry-due-to-server-authentication-in-streaming-mode-response-code-is-401/217564>\
**Category:** APM\
**Tags:** java\
**Created:** [February 3, 2020, 6:05am UTC](https://discuss.elastic.co/t/apm-reporter-error-co-elastic-apm-agent-report-intakev2reportingeventhandler-error-sending-data-to-apm-server-cannot-retry-due-to-server-authentication-in-streaming-mode-response-code-is-401/217564 "2020-02-03T06:05:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![kumar\_kung](https://avatars.discourse-cdn.com/v4/letter/k/9dc877/32.png) [@kumar\_kung](https://discuss.elastic.co/u/kumar_kung)\
**Post date:** [February 3, 2020, 6:05am UTC](https://discuss.elastic.co/t/apm-reporter-error-co-elastic-apm-agent-report-intakev2reportingeventhandler-error-sending-data-to-apm-server-cannot-retry-due-to-server-authentication-in-streaming-mode-response-code-is-401/217564/1 "2020-02-03T06:05:19Z")

</div>

**Kibana version** : 7.5.2

**Elasticsearch version** : 7.5.2

**APM Server version** : 7.5.2

\*\*APM Agent language \*\*: java

- _Original install method_ : ECK operator 1.0.0 GA

I have updated apm-server-quickstart-apm-token secret-token to a known value, but the apm agent is unable to connect to apm server, throwing authentication error. Please let me know which secret should i update for apm server to accept secret-token i have set

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [February 3, 2020, 6:50am UTC](https://discuss.elastic.co/t/apm-reporter-error-co-elastic-apm-agent-report-intakev2reportingeventhandler-error-sending-data-to-apm-server-cannot-retry-due-to-server-authentication-in-streaming-mode-response-code-is-401/217564/2 "2020-02-03T06:50:31Z")

</div>

Take a look at [this](https://www.elastic.co/guide/en/cloud-on-k8s/1.0/k8s-apm-server.html#k8s-apm-secret-token). The specified command should get you the secret token.  
Make sure it is Base-64-encoded and stored in the right field. Then make sure the agent actually uses the right token (or retrieves it from the right secret, if using the approach suggested in the blog post).

---

<div class="post-metadata">

**Author:** ![kumar\_kung](https://avatars.discourse-cdn.com/v4/letter/k/9dc877/32.png) [@kumar\_kung](https://discuss.elastic.co/u/kumar_kung)\
**Post date:** [February 3, 2020, 7:26am UTC](https://discuss.elastic.co/t/apm-reporter-error-co-elastic-apm-agent-report-intakev2reportingeventhandler-error-sending-data-to-apm-server-cannot-retry-due-to-server-authentication-in-streaming-mode-response-code-is-401/217564/3 "2020-02-03T07:26:53Z")

</div>

Thanks @Eyal_Koren

kubectl get secret/apm-server-quickstart-apm-token -o go-template='{{index .data "secret-token" | base64decode}}' -n elastic-system  
output: elasticuser

-Delastic.apm.secret\_token=elasticuser

apm-server-quickstart-apm-token and elastic.apm.secret\_token are elasticuser, yet i am getting authentication issue.

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [February 3, 2020, 7:58am UTC](https://discuss.elastic.co/t/apm-reporter-error-co-elastic-apm-agent-report-intakev2reportingeventhandler-error-sending-data-to-apm-server-cannot-retry-due-to-server-authentication-in-streaming-mode-response-code-is-401/217564/4 "2020-02-03T07:58:06Z")

</div>

Did you configure the [APM server](https://www.elastic.co/guide/en/apm/server/current/secure-communication-agents.html#secret-token) to use the same token as well?

---

<div class="post-metadata">

**Author:** ![kumar\_kung](https://avatars.discourse-cdn.com/v4/letter/k/9dc877/32.png) [@kumar\_kung](https://discuss.elastic.co/u/kumar_kung)\
**Post date:** [February 3, 2020, 8:05am UTC](https://discuss.elastic.co/t/apm-reporter-error-co-elastic-apm-agent-report-intakev2reportingeventhandler-error-sending-data-to-apm-server-cannot-retry-due-to-server-authentication-in-streaming-mode-response-code-is-401/217564/5 "2020-02-03T08:05:30Z")

</div>

> [@Eyal\_Koren](#):
>
> using

kubectl get secret/apm-server-quickstart-apm-token -o go-template='{{index .data "secret-token" | base64decode}}' -n elastic-system  
output: elasticuser

-Delastic.apm.secret\_token=elasticuser

any value set in apm-server-quickstart-apm-token secret will be used by apm-sever right? doesnt it automatically take it, if not pls let me know where to make change for secret token to be used by apm-server in eck

find apm-server-quickstart-apm-config:  
apm-server:  
host: :8200  
secret\_token: ${SECRET\_TOKEN}

---

<div class="post-metadata">

**Author:** ![axw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axw/32/28197_2.png) [@axw](https://discuss.elastic.co/u/axw)\
**Post date:** [February 3, 2020, 10:53am UTC](https://discuss.elastic.co/t/apm-reporter-error-co-elastic-apm-agent-report-intakev2reportingeventhandler-error-sending-data-to-apm-server-cannot-retry-due-to-server-authentication-in-streaming-mode-response-code-is-401/217564/6 "2020-02-03T10:53:25Z")

</div>

Did you set that secret value _after_ creating the ApmServer resource? If so, I suspect you're hitting [https://github.com/elastic/cloud-on-k8s/issues/523](https://github.com/elastic/cloud-on-k8s/issues/523). Until that's addressed, if you delete the apm-server pod then the new one should pick up the updated secret token.

---

<div class="post-metadata">

**Author:** ![kumar\_kung](https://avatars.discourse-cdn.com/v4/letter/k/9dc877/32.png) [@kumar\_kung](https://discuss.elastic.co/u/kumar_kung)\
**Post date:** [February 3, 2020, 11:07am UTC](https://discuss.elastic.co/t/apm-reporter-error-co-elastic-apm-agent-report-intakev2reportingeventhandler-error-sending-data-to-apm-server-cannot-retry-due-to-server-authentication-in-streaming-mode-response-code-is-401/217564/7 "2020-02-03T11:07:09Z")

</div>

Yes, i was creating secret post apm server resource creation , thanks

---

<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 24, 2020, 7:09am UTC](https://discuss.elastic.co/t/apm-reporter-error-co-elastic-apm-agent-report-intakev2reportingeventhandler-error-sending-data-to-apm-server-cannot-retry-due-to-server-authentication-in-streaming-mode-response-code-is-401/217564/8 "2020-02-24T07:09:36Z")

</div>

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