# Hpe\_invalid constant

**URL:** <https://discourse.nodered.org/t/hpe-invalid-constant/22255>\
**Category:** General\
**Created:** [25 February 2020 19:32 UTC](https://discourse.nodered.org/t/hpe-invalid-constant/22255 "2020-02-25T19:32:47Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Waynedejager](https://avatars.discourse-cdn.com/v4/letter/w/bc79bd/32.png) [@Waynedejager](https://discourse.nodered.org/u/Waynedejager)\
**Post date:** [25 February 2020 19:32 UTC](https://discourse.nodered.org/t/hpe-invalid-constant/22255/1 "2020-02-25T19:32:48Z")

</div>

Hi - Newbie here. ( Go Easy 😉

I have a device which runs a web browser ( ESP8266 ) with sensors collecting electricity values. The device runs a basic http Query API which can be triggered via browser and the payload is either Json or CSV.

In my very basic first attempt with Node-Red i have started with an "Inject node" ( because i cannot figure out how to run a http node without "inject" - anyway Node flow for test is "Inject / HTTP Request / Debug " ( see screenshot ).

 ![Screenshot 2020-02-25 at 21.22.44](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/9/7995152f308a224219936d86aa487b48463932f4.png)

I have tried various options within the "HTTP Request" node but keep getting "HPE\_INVALID CONSTANT". I cannot continue - any help please ??

By the way the HTTP string works fine from Browser level:-  
[http://41.192.149.206:8080/query?select=[time.iso,ch1.d2,ch1.amps.d2,ch1.va.d2,ch1.pf.d2,ch2.d2,ch2.amps.d2,ch2.va.d2,ch2.pf.d2,ch3.d2,ch3.amps.d2,ch3.va.d2,ch3.pf.d2,ch4.d2,ch4.amps.d2,ch4.va.d2,ch4.pf.d2,ch5.d2,ch5.amps.d2,ch5.va.d2,ch5.pf.d2,ch6.d2,ch6.amps.d2,ch6.va.d2,ch6.pf.d2,ch7.d2,ch7.amps.d2,ch7.va.d2,ch7.pf.d2,ch8.d2,ch8.amps.d2,ch8.va.d2,ch8.pf.d2,ch9.d2,ch9.amps.d2,ch9.va.d2,ch9.pf.d2,ch10.d2,ch10.amps.d2,ch10.va.d2,ch10.pf.d2,ch11.d2,ch11.amps.d2,ch11.va.d2,ch11.pf.d2,ch12.d2,ch12.amps.d2,ch12.va.d2,ch12.pf.d2]&begin=h-30m&end=h&group=30m&format=json&header=yes](http://41.192.149.206:8080/query?select=%5Btime.iso,ch1.d2,ch1.amps.d2,ch1.va.d2,ch1.pf.d2,ch2.d2,ch2.amps.d2,ch2.va.d2,ch2.pf.d2,ch3.d2,ch3.amps.d2,ch3.va.d2,ch3.pf.d2,ch4.d2,ch4.amps.d2,ch4.va.d2,ch4.pf.d2,ch5.d2,ch5.amps.d2,ch5.va.d2,ch5.pf.d2,ch6.d2,ch6.amps.d2,ch6.va.d2,ch6.pf.d2,ch7.d2,ch7.amps.d2,ch7.va.d2,ch7.pf.d2,ch8.d2,ch8.amps.d2,ch8.va.d2,ch8.pf.d2,ch9.d2,ch9.amps.d2,ch9.va.d2,ch9.pf.d2,ch10.d2,ch10.amps.d2,ch10.va.d2,ch10.pf.d2,ch11.d2,ch11.amps.d2,ch11.va.d2,ch11.pf.d2,ch12.d2,ch12.amps.d2,ch12.va.d2,ch12.pf.d2%5D&begin=h-30m&end=h&group=30m&format=json&header=yes)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [25 February 2020 19:57 UTC](https://discourse.nodered.org/t/hpe-invalid-constant/22255/2 "2020-02-25T19:57:09Z")

</div>

A quick Google search for the hpe error gives the answer:

> <https://stackoverflow.com/questions/34769824/what-does-this-error-mean-hpe-invalid-constant>

In summary, your device web server is using an old version of http that node.js doesn't support.

---

<div class="post-metadata">

**Author:** ![Waynedejager](https://avatars.discourse-cdn.com/v4/letter/w/bc79bd/32.png) [@Waynedejager](https://discourse.nodered.org/u/Waynedejager)\
**Post date:** [25 February 2020 20:08 UTC](https://discourse.nodered.org/t/hpe-invalid-constant/22255/3 "2020-02-25T20:08:33Z")

</div>

I saw that post on stack - i ran Curl -I with the URL in Terminal and response code is HTTP /1.1

 ![Screenshot 2020-02-25 at 22.05.39](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/9/69f19e89928eed4de10ab9d1157061022946f046.png)

Not sure that is my problem? What do you think @knolleary is there anything else you can think i try?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [25 February 2020 20:17 UTC](https://discourse.nodered.org/t/hpe-invalid-constant/22255/4 "2020-02-25T20:17:01Z")

</div>

Is the server setting the content-length correctly ?

---

<div class="post-metadata">

**Author:** ![Waynedejager](https://avatars.discourse-cdn.com/v4/letter/w/bc79bd/32.png) [@Waynedejager](https://discourse.nodered.org/u/Waynedejager)\
**Post date:** [25 February 2020 20:18 UTC](https://discourse.nodered.org/t/hpe-invalid-constant/22255/5 "2020-02-25T20:18:31Z")

</div>

Not sure what that means - or how to check ? Query works in browser ( if that helps )

---

<div class="post-metadata">

**Author:** ![Waynedejager](https://avatars.discourse-cdn.com/v4/letter/w/bc79bd/32.png) [@Waynedejager](https://discourse.nodered.org/u/Waynedejager)\
**Post date:** [25 February 2020 20:47 UTC](https://discourse.nodered.org/t/hpe-invalid-constant/22255/6 "2020-02-25T20:47:46Z")

</div>

@knolleary @dceejay - I tried the same Query with Thingsboard "rest API call" now and dont get any errors. So i am hoping its something small that i am overlooking in NR?

---

<div class="post-metadata">

**Author:** ![Waynedejager](https://avatars.discourse-cdn.com/v4/letter/w/bc79bd/32.png) [@Waynedejager](https://discourse.nodered.org/u/Waynedejager)\
**Post date:** [25 February 2020 22:01 UTC](https://discourse.nodered.org/t/hpe-invalid-constant/22255/7 "2020-02-25T22:01:46Z")

</div>

Any ideas community?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [25 February 2020 22:36 UTC](https://discourse.nodered.org/t/hpe-invalid-constant/22255/8 "2020-02-25T22:36:56Z")

</div>

Well it means that there is something wrong with the response from the server - normally it means the header is incorrect. I see that it does include a length (108267 bytes) - is the response exactly that long ?

---

<div class="post-metadata">

**Author:** ![Waynedejager](https://avatars.discourse-cdn.com/v4/letter/w/bc79bd/32.png) [@Waynedejager](https://discourse.nodered.org/u/Waynedejager)\
**Post date:** [26 February 2020 06:37 UTC](https://discourse.nodered.org/t/hpe-invalid-constant/22255/9 "2020-02-26T06:37:11Z")

</div>

> [@dceejay](#):
>
> I see that it does include a length (108267 bytes)

this is the length of the response from just the url , which serves up a html page. I just posted this result to see that the http was infact 1.1 to exclude Nicks theory.

> [@dceejay](#):
>
> normally it means the header is incorrect

In my query i can set Header=yes / no , either give the "HPE invalid constant".

Is there perhaps a different node i could try to troubleshoot or approach from a different angle?

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [26 February 2020 06:54 UTC](https://discourse.nodered.org/t/hpe-invalid-constant/22255/10 "2020-02-26T06:54:30Z")

</div>

The http-request node uses the NodeJS `request` module.  
If you have some basic NodeJS skills, you could use a small test script and track down the error outside of Node-RED first.

Good starting point would be the example from the docs.

> **[request](https://www.npmjs.com/package/request)**
>
> Simplified HTTP request client.

Just do the following:

1. create a new directory and change into it
2. run `npm install request`
3. create a JS file with the code from the example
4. run it with `node myfile.js`

---

<div class="post-metadata">

**Author:** ![Waynedejager](https://avatars.discourse-cdn.com/v4/letter/w/bc79bd/32.png) [@Waynedejager](https://discourse.nodered.org/u/Waynedejager)\
**Post date:** [26 February 2020 14:08 UTC](https://discourse.nodered.org/t/hpe-invalid-constant/22255/11 "2020-02-26T14:08:08Z")

</div>

> [@kuema](#):
>
> If you have some basic NodeJS skills

I dont ;-( but i will try . Thank You

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [26 April 2020 14:08 UTC](https://discourse.nodered.org/t/hpe-invalid-constant/22255/12 "2020-04-26T14:08:10Z")

</div>

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