# Empty payload from http request after updated node-red

**URL:** <https://discourse.nodered.org/t/empty-payload-from-http-request-after-updated-node-red/52840>\
**Category:** General\
**Created:** [27 October 2021 16:31 UTC](https://discourse.nodered.org/t/empty-payload-from-http-request-after-updated-node-red/52840 "2021-10-27T16:31:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![elinds](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/elinds/32/50066_2.png) [@elinds](https://discourse.nodered.org/u/elinds)\
**Post date:** [27 October 2021 16:31 UTC](https://discourse.nodered.org/t/empty-payload-from-http-request-after-updated-node-red/52840/1 "2021-10-27T16:31:52Z")

</div>

I run node-red on osx and after I upgraded node-red my http requests don’t work anymore.

I try to fetch a json-file from a server I’m hosting but payload is always empty. I run the exact same flow as I did before my upgrade where it worked just fine.

I check the traffic with wireshark and I see there is a complete response sent back to node-red but payload is empty. Response code is 200.

If I change the url to [www.google.com](http://www.google.com) I do get a response payload. But from my local server there is no response payload. I can access the same url from my browser or if I write a simple snippet in nodejs to do the request it works..

This is a very strange behaviour that started just after an upgrade.

Anyone seen a similar thing?

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [27 October 2021 19:05 UTC](https://discourse.nodered.org/t/empty-payload-from-http-request-after-updated-node-red/52840/2 "2021-10-27T19:05:48Z")

</div>

> [@elinds](#):
>
> Anyone seen a similar thing?

I remember i read about a similar issue a while back.  
From what version of NR did you upgrade ?

Check this issue in node-red Github relating how redirects are handled and see if the suggestions help  
with your problem.

> <https://github.com/node-red/node-red/issues/3102>
>
> \### Current Behavior
> 
> POSTing credentials to MyFitnessPal's login endpoint retur…ns a 404. 
> 
> \### Expected Behavior
> 
> Under 1.3.4 it returns a 302 redirect and authentication cookies.
> 
> \### Steps To Reproduce
> 
> Using my flow:
> 
> \- Create credentials on MyFitnessPal (https://www.myfitnesspal.com/account/create)
> \- Add credentials to the inject node at the start of the flow
> \- Deploy flow to NodeRed
> \- Inject
> \- Watch the debug output
> - http status should return 302 with a simple redirect html as the payload rather than 404 with the html of a 404 page
> 
> \### Example flow
> 
> \`\`\`
> \[{"id":"706f8b78.caf304","type":"tab","label":"Login Test","disabled":false,"info":""},{"id":"9f19cdc7.37621","type":"http request","z":"706f8b78.caf304","name":"Get Login","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://www.myfitnesspal.com/account/login","tls":"","persist":false,"proxy":"","authType":"","x":100,"y":140,"wires":\[\["3587fd6f.9e1e42"\]\]},{"id":"3587fd6f.9e1e42","type":"html","z":"706f8b78.caf304","name":"Auth Token Extractor","property":"payload","outproperty":"authenticity\_token","tag":"form.login \> input\[name='authenticity\_token'\]","ret":"attr","as":"single","x":160,"y":200,"wires":\[\["80d18b85.901ac8"\]\]},{"id":"80d18b85.901ac8","type":"function","z":"706f8b78.caf304","name":"Prepare POST","func":"msg.token = msg.authenticity\_token\[0\].value;\\nmsg.url = \\"https://www.myfitnesspal.com/account/login\\";\\nmsg.method = \\"POST\\";\\nmsg.contentType = \\"application/x-www-form-urlencoded\\";\\nmsg.payload = \\"utf8=%E2%9C%93&authenticity\_token=\\" + encodeURIComponent(msg.token) + \\"&username=\\" + encodeURIComponent(msg.user) + \\"&password=\\" + encodeURIComponent(msg.password) + \\"&remember\_me=1\\";\\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":\[\],"x":200,"y":260,"wires":\[\["a5d06021.66c82"\]\]},{"id":"a5d06021.66c82","type":"http request","z":"706f8b78.caf304","name":"POST","method":"use","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":270,"y":320,"wires":\[\["ce55b898.7b5558"\]\]},{"id":"27a14c06.19c8c4","type":"inject","z":"706f8b78.caf304","name":"Do It","props":\[{"p":"payload"},{"p":"user","v":"","vt":"str"},{"p":"password","v":"","vt":"str"}\],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":90,"y":80,"wires":\[\["9f19cdc7.37621"\]\]},{"id":"ce55b898.7b5558","type":"debug","z":"706f8b78.caf304","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":290,"y":380,"wires":\[\]}\]
> \`\`\`
> 
> 
> \### Environment
> 
> \- Node-RED version: 2.0.5
> \- Node.js version: 14.17.?
> \- npm version: ?
> \- Platform/OS: Synology DS920+, Docker
> \- Browser: Brave 1.27.109

---

<div class="post-metadata">

**Author:** ![elinds](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/elinds/32/50066_2.png) [@elinds](https://discourse.nodered.org/u/elinds)\
**Post date:** [28 October 2021 12:39 UTC](https://discourse.nodered.org/t/empty-payload-from-http-request-after-updated-node-red/52840/3 "2021-10-28T12:39:42Z")

</div>

Problem solved by upgrading nodejs from 14 to 16.

Regards

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [28 October 2021 13:20 UTC](https://discourse.nodered.org/t/empty-payload-from-http-request-after-updated-node-red/52840/4 "2021-10-28T13:20:12Z")

</div>

The NodeJS version "shouldn't" matter.

From 1.x to 2.x we swapped out the library (from request to got) used to make the http request and have tried very hard to make it's behaviour match.

You said you wrote some code to test, which library did you use?

We probably need some more information to workout what's going on.

- Do you know what response headers your service sends with the JSON object?
- What framework or http server is Node-RED connecting to?

Or if you could grab a packet capture of the request/response (e.g. with wireshark) that would be useful.

---

<div class="post-metadata">

**Author:** ![elinds](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/elinds/32/50066_2.png) [@elinds](https://discourse.nodered.org/u/elinds)\
**Post date:** [28 October 2021 16:01 UTC](https://discourse.nodered.org/t/empty-payload-from-http-request-after-updated-node-red/52840/5 "2021-10-28T16:01:17Z")

</div>

Hi,  
I made a small snippet with requests didn’t understand it was got nowadays 🙂

I was communicating with a python flask server and also a small LTE routers built in web server.

Unfortunately I did not save the wireshark capture, I just verified that the content where sent from the web server to my computer running node-red.  
Content length was correct and response code was 200. Just payload empty.

But all I did now was changed from node 14 to 16 and things just worked fine again.

---

<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:** [27 December 2021 16:02 UTC](https://discourse.nodered.org/t/empty-payload-from-http-request-after-updated-node-red/52840/6 "2021-12-27T16:02:11Z")

</div>

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