# Can't solve "ReferenceError: err is not defined"

**URL:** https://discourse.nodered.org/t/cant-solve-referenceerror-err-is-not-defined/70021
**Category:** General
**Created:** [3 November 2022 12:53 UTC](https://discourse.nodered.org/t/cant-solve-referenceerror-err-is-not-defined/70021 "2022-11-03T12:53:04Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Li\_mdv](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/li_mdv/32/70131_2.png) [@Li\_mdv](https://discourse.nodered.org/u/Li_mdv)
#### Post date: [3 November 2022 12:53 UTC](https://discourse.nodered.org/t/cant-solve-referenceerror-err-is-not-defined/70021/1 "2022-11-03T12:53:04Z")

</div>

Hello team,

I've been facing a problem for several weeks now that I can't seem to solve.  
I am using npm 6.14.8, nodeJS 12.19.0 and Node Red v1.2.2.

I am not an expert on Node Red and I am trying to run a simple scenario. Send an http request via NTLM\*(node-red-contrib-http-ntlm-req)\* authentication protocol and display the response. The problem is that I get an error in the debug window ("ReferenceError: err is not defined") and no response from the request (qualified on Postman).

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/6/4675f6bedd3de07629fb0f63b16556e92b13000e.png)

The complete error message :

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/3/33b60eda71321a216d29c7e805ac95b2b377e31d.png)

Can you help me to understand the origin of this problem?  
Thank you in advance.

Lionel

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [3 November 2022 13:13 UTC](https://discourse.nodered.org/t/cant-solve-referenceerror-err-is-not-defined/70021/2 "2022-11-03T13:13:04Z")

</div>

Looks like a bug in the node (using `err.message`)...

> <https://github.com/dmvstar/node-red-contrib-http-ntlm-req/blob/541a824945266c2274a07db848e1d2713bd8c1ce/http-ntlm-req.js#L160>

You should raise an issue on that repository.

* * *

However, looking further up that code, you will see it expects `method` to contain `'0'` or `'1'`

Looking a little further up, it shows...

```auto
                    switch (msg.method) {
						case 'GET':
							method = '0';
						break;
						case 'POST':
							method = '1';
						break;
					}

```

In other words - did you set `msg.method` to "GET" or "POST" or something else?

---

<div class="post-metadata">

### Author: ![Li\_mdv](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/li_mdv/32/70131_2.png) [@Li\_mdv](https://discourse.nodered.org/u/Li_mdv)
#### Post date: [3 November 2022 15:04 UTC](https://discourse.nodered.org/t/cant-solve-referenceerror-err-is-not-defined/70021/3 "2022-11-03T15:04:03Z")

</div>

Thank you for your reply @Steve-Mcl which helped me a lot.

I did forgot to set `msg.method` and that solved the issue.  
I have a second question, maybe you can help me. Do you know how to import/upload a CA Certificate ? It would help me to specify it before the node "http-ntlm-req" and hopefully remove the "unable to get local issuer certificate" error .

Thanks again.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [3 November 2022 15:09 UTC](https://discourse.nodered.org/t/cant-solve-referenceerror-err-is-not-defined/70021/4 "2022-11-03T15:09:29Z")

</div>

No, sorry, I have never used that node.

Either start a new thread (with appropriate title to attract the correct members) OR raise an issue on the repository for the author to instruct you.

e.g. `Can’t solve “ReferenceError: err is not defined”` is not a good title. I had no idea of the subject.

A title like **"unable to get local issuer certificate: `node-red-contrib-http-ntlm-req`"** tells passers by that you have an error, that it is related to certificates & the name of node you are using.

---

<div class="post-metadata">

### Author: ![Li\_mdv](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/li_mdv/32/70131_2.png) [@Li\_mdv](https://discourse.nodered.org/u/Li_mdv)
#### Post date: [3 November 2022 15:14 UTC](https://discourse.nodered.org/t/cant-solve-referenceerror-err-is-not-defined/70021/5 "2022-11-03T15:14:58Z")

</div>

Fine, thanks again for your help.

Have a good day.

---

<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: [17 November 2022 15:15 UTC](https://discourse.nodered.org/t/cant-solve-referenceerror-err-is-not-defined/70021/6 "2022-11-17T15:15:51Z")

</div>

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