# HPE\_INVALID\_CONSTANT nodejs elastic apm

**URL:** <https://discuss.elastic.co/t/hpe-invalid-constant-nodejs-elastic-apm/272795>\
**Category:** APM\
**Tags:** nodejs\
**Created:** [May 12, 2021, 10:30am UTC](https://discuss.elastic.co/t/hpe-invalid-constant-nodejs-elastic-apm/272795 "2021-05-12T10:30:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Max\_Lee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/max_lee/32/82242_2.png) [@Max\_Lee](https://discuss.elastic.co/u/Max_Lee)\
**Post date:** [May 12, 2021, 10:30am UTC](https://discuss.elastic.co/t/hpe-invalid-constant-nodejs-elastic-apm/272795/1 "2021-05-12T10:30:18Z")

</div>

**Kibana version** :  
v7.12.1

**Elasticsearch version** :  
v7.12.1

**APM Server version** :  
v7.12.1

**APM Agent language and version** :  
nodejs : 12  
fastify : 2.11.0  
mongoose : 5.11.1  
elastic-apm-node : 3.14.0  
ioredis : 4.14.1

**Browser version** :  
Google Chrome 90.0.4430.85

**Fresh install or upgraded from other version?**  
fresh install

**Steps to reproduce** :

1. Launch APM server, elastic search, and Kibana containers
2. Install Node APM in the server
3. Run express/fastify (whatever)

**Errors in browser console (if relevant)**:  
`{"log.level":"error","@timestamp":"2021-05-12T10:26:51.748Z","log":{"logger":"elastic-apm-node"},"ecs":{"version":"1.6.0"},"message":"APM Server transport error (HPE_INVALID_CONSTANT): Parse Error: Expected HTTP/"}`

**Provide logs and/or server output (if relevant)**:

According to elastic document, I found this error every 5 seconds(?), not exactly. how can i fix that?  
please tell me about solution. (use express or fastify, it doesn't matter)

thank you.

---

<div class="post-metadata">

**Author:** ![alanstorm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alanstorm/32/77134_2.png) [@alanstorm](https://discuss.elastic.co/u/alanstorm)\
**Post date:** [May 12, 2021, 4:51pm UTC](https://discuss.elastic.co/t/hpe-invalid-constant-nodejs-elastic-apm/272795/2 "2021-05-12T16:51:01Z")

</div>

Nice to meet you @Max_Lee and thanks for reporting this.

That's an interesting error that we haven't seen before. The `HPE_INVALID_CONSTANT` error comes from Node.js, and usually indicates Node.js couldn't parse an HTTP response when making a request to a server. It looks like that response came from the request Node.js makes to APM Server when sending agent data.

Two questions come to mind that might help us debug this,

1. In your agent's configuration, what value is `serverUrl` set to?
2. Is APM Server receiving telemetry data and sending it to your elasticsearch instance? (in other words, are you seeing data in the APM section of Kibana?)

---

<div class="post-metadata">

**Author:** ![Max\_Lee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/max_lee/32/82242_2.png) [@Max\_Lee](https://discuss.elastic.co/u/Max_Lee)\
**Post date:** [May 17, 2021, 7:13am UTC](https://discuss.elastic.co/t/hpe-invalid-constant-nodejs-elastic-apm/272795/3 "2021-05-17T07:13:11Z")

</div>

this problem causes my fault (remove some files in node\_modules), delete and re-npm install then resolved this problem.

thank you.

---

<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:** [June 7, 2021, 3:13am UTC](https://discuss.elastic.co/t/hpe-invalid-constant-nodejs-elastic-apm/272795/4 "2021-06-07T03:13:35Z")

</div>

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