# While running the flow getting servet time out error

**URL:** <https://discourse.nodered.org/t/while-running-the-flow-getting-servet-time-out-error/9227>\
**Category:** General\
**Created:** [20 March 2019 11:18 UTC](https://discourse.nodered.org/t/while-running-the-flow-getting-servet-time-out-error/9227 "2019-03-20T11:18:29Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Umang](https://avatars.discourse-cdn.com/v4/letter/u/db5fbb/32.png) [@Umang](https://discourse.nodered.org/u/Umang)\
**Post date:** [20 March 2019 11:18 UTC](https://discourse.nodered.org/t/while-running-the-flow-getting-servet-time-out-error/9227/1 "2019-03-20T11:18:29Z")

</div>

I want to create a http request and the get a desired json file output. I have done the following this and I am getting a timeout error while running please help.  
The flow is as follows:  
[{"id":"2e661d86.fa8792","type":"http in","z":"b53fc322.1dcb7","name":"/time","url":"/time","method":"get","upload":false,"swaggerDoc":"","x":130,"y":280,"wires":[["8cd25dc8.9a8d9"]]},{"id":"8cd25dc8.9a8d9","type":"function","z":"b53fc322.1dcb7","name":"Time","func":"var d = new Date(); // for now\nvar hour = d.getHours(); // =\> 9\nvar min = d.getMinutes(); // =\> 30\nif(hour \< 10){\n hour = '0' + hour\n}\nif(min \< 10){\n min = '0'+ min\n}\nmsg.payload = {'hours':hour,\n 'minutes':min}\nreturn msg","outputs":1,"noerr":0,"x":300,"y":280,"wires":[["4205f606.514958"]]},{"id":"4205f606.514958","type":"template","z":"b53fc322.1dcb7","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Time last server time request received at {{payload.hours}}:{{payload.minutes}}\n","output":"json","x":460,"y":280,"wires":[["bf8f7c07.8cea1"]]},{"id":"bf8f7c07.8cea1","type":"function","z":"b53fc322.1dcb7","name":"Header","func":"// If sending JSON data the content type is:\n//msg.headers={"Content-Type":"application/json"}\n\n// For HTML use the content type line below:\nmsg.headers={"Content-Type":"text/html"}\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":280,"wires":[["2e1c54e0.51a52c"]]},{"id":"2e1c54e0.51a52c","type":"http response","z":"b53fc322.1dcb7","name":"","statusCode":"","headers":{},"x":800,"y":280,"wires":},{"id":"3e0356fa.dc088a","type":"http in","z":"b53fc322.1dcb7","name":"/random","url":"/random","method":"get","upload":false,"swaggerDoc":"","x":140,"y":360,"wires":[["d5c3b5fb.4cd768"]]},{"id":"d5c3b5fb.4cd768","type":"function","z":"b53fc322.1dcb7","name":"Random","func":"rnd = Math.round(Math.random() \*100)\nvar d1 = new Date(); // for now\nvar hour1 = d1.getHours(); // =\> 9\nvar min1 = d1.getMinutes(); // =\> 30\nif(hour1 \< 10){\n hour1 = '0' + hour1\n}\nif(min1 \< 10){\n min1 = '0'+ min1\n}\nmsg.payload = {'random':rnd,\n 'hours':hour1,\n 'minutes':min1\n}\nreturn msg","outputs":1,"noerr":0,"x":300,"y":360,"wires":[["6c6d5d0f.ef2a54","422c7eb5.4e99a"]]},{"id":"6c6d5d0f.ef2a54","type":"template","z":"b53fc322.1dcb7","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Last random number request returned {{payload.random}}\n","output":"json","x":460,"y":360,"wires":[["54aad7da.b41ce8"]]},{"id":"54aad7da.b41ce8","type":"function","z":"b53fc322.1dcb7","name":"Header","func":"// If sending JSON data the content type is:\n//msg.headers={"Content-Type":"application/json"}\n\n// For HTML use the content type line below:\nmsg.headers={"Content-Type":"text/html"}\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":360,"wires":[["7e5ccc8d.b85784"]]},{"id":"7e5ccc8d.b85784","type":"http response","z":"b53fc322.1dcb7","name":"","statusCode":"","headers":{},"x":800,"y":360,"wires":},{"id":"572d0a8c.5f80b4","type":"http in","z":"b53fc322.1dcb7","name":"/page","url":"/page","method":"get","upload":false,"swaggerDoc":"","x":130,"y":420,"wires":[["3d6981a7.3cd1fe"]]},{"id":"3d6981a7.3cd1fe","type":"function","z":"b53fc322.1dcb7","name":"Page","func":"rnd = Math.round(Math.random() \*100)\nvar d = new Date(); // for now\nvar hour = d.getHours(); // =\> 9\nvar min = d.getMinutes(); // =\> 30\nif(hour \< 10){\n hour = '0' + hour\n}\nif(min \< 10){\n min = '0'+ min\n}\nmsg.payload = {'hours':hour,\n 'minutes':min,\n 'random':rnd\n}\nreturn msg","outputs":1,"noerr":0,"x":300,"y":420,"wires":[["422c7eb5.4e99a"]]},{"id":"422c7eb5.4e99a","type":"template","z":"b53fc322.1dcb7","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Time last server time request received at {{payload.hours}}:{{payload.minutes}}\nLast random number request returned {{payload.random}}, which was received at {{payload.hours}}:{{payload.minutes}}\n","output":"json","x":460,"y":420,"wires":[["bc5cd986.75d568"]]},{"id":"bc5cd986.75d568","type":"function","z":"b53fc322.1dcb7","name":"Header","func":"// If sending JSON data the content type is:\n//msg.headers={"Content-Type":"application/json"}\n\n// For HTML use the content type line below:\nmsg.headers={"Content-Type":"text/html"}\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":420,"wires":[["d686f052.15c9f"]]},{"id":"d686f052.15c9f","type":"http response","z":"b53fc322.1dcb7","name":"","statusCode":"","headers":{},"x":800,"y":420,"wires":}]

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [20 March 2019 11:24 UTC](https://discourse.nodered.org/t/while-running-the-flow-getting-servet-time-out-error/9227/2 "2019-03-20T11:24:08Z")

</div>

1. fix your flow - see [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)
2. what platform - i.e.os and release
3. what version of NR and node.js
4. what 'contrib' nodes are you using? i.e. node-red-contrib-xxxxxxxx

---

<div class="post-metadata">

**Author:** ![Umang](https://avatars.discourse-cdn.com/v4/letter/u/db5fbb/32.png) [@Umang](https://discourse.nodered.org/u/Umang)\
**Post date:** [20 March 2019 11:39 UTC](https://discourse.nodered.org/t/while-running-the-flow-getting-servet-time-out-error/9227/3 "2019-03-20T11:39:53Z")

</div>

I want to create a http request and the get a desired json file output. I have done the following this and I am getting a timeout error while running please help.  
The flow is as follows:

```auto
[{"id":"2e661d86.fa8792","type":"http in","z":"b53fc322.1dcb7","name":"/time","url":"/time","method":"get","upload":false,"swaggerDoc":"","x":130,"y":280,"wires":[["8cd25dc8.9a8d9"]]},{"id":"8cd25dc8.9a8d9","type":"function","z":"b53fc322.1dcb7","name":"Time","func":"var d = new Date(); // for now\nvar hour = d.getHours(); // => 9\nvar min = d.getMinutes(); // => 30\nif(hour < 10){\n hour = '0' + hour\n}\nif(min < 10){\n min = '0'+ min\n}\nmsg.payload = {'hours':hour,\n 'minutes':min}\nreturn msg","outputs":1,"noerr":0,"x":300,"y":280,"wires":[["4205f606.514958"]]},{"id":"4205f606.514958","type":"template","z":"b53fc322.1dcb7","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Time last server time request received at {{payload.hours}}:{{payload.minutes}}\n","output":"json","x":460,"y":280,"wires":[["bf8f7c07.8cea1"]]},{"id":"bf8f7c07.8cea1","type":"function","z":"b53fc322.1dcb7","name":"Header","func":"// If sending JSON data the content type is:\n//msg.headers={"Content-Type":"application/json"}\n\n// For HTML use the content type line below:\nmsg.headers={"Content-Type":"text/html"}\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":280,"wires":[["2e1c54e0.51a52c"]]},{"id":"2e1c54e0.51a52c","type":"http response","z":"b53fc322.1dcb7","name":"","statusCode":"","headers":{},"x":800,"y":280,"wires":},{"id":"3e0356fa.dc088a","type":"http in","z":"b53fc322.1dcb7","name":"/random","url":"/random","method":"get","upload":false,"swaggerDoc":"","x":140,"y":360,"wires":[["d5c3b5fb.4cd768"]]},{"id":"d5c3b5fb.4cd768","type":"function","z":"b53fc322.1dcb7","name":"Random","func":"rnd = Math.round(Math.random() *100)\nvar d1 = new Date(); // for now\nvar hour1 = d1.getHours(); // => 9\nvar min1 = d1.getMinutes(); // => 30\nif(hour1 < 10){\n hour1 = '0' + hour1\n}\nif(min1 < 10){\n min1 = '0'+ min1\n}\nmsg.payload = {'random':rnd,\n 'hours':hour1,\n 'minutes':min1\n}\nreturn msg","outputs":1,"noerr":0,"x":300,"y":360,"wires":[["6c6d5d0f.ef2a54","422c7eb5.4e99a"]]},{"id":"6c6d5d0f.ef2a54","type":"template","z":"b53fc322.1dcb7","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Last random number request returned {{payload.random}}\n","output":"json","x":460,"y":360,"wires":[["54aad7da.b41ce8"]]},{"id":"54aad7da.b41ce8","type":"function","z":"b53fc322.1dcb7","name":"Header","func":"// If sending JSON data the content type is:\n//msg.headers={"Content-Type":"application/json"}\n\n// For HTML use the content type line below:\nmsg.headers={"Content-Type":"text/html"}\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":360,"wires":[["7e5ccc8d.b85784"]]},{"id":"7e5ccc8d.b85784","type":"http response","z":"b53fc322.1dcb7","name":"","statusCode":"","headers":{},"x":800,"y":360,"wires":},{"id":"572d0a8c.5f80b4","type":"http in","z":"b53fc322.1dcb7","name":"/page","url":"/page","method":"get","upload":false,"swaggerDoc":"","x":130,"y":420,"wires":[["3d6981a7.3cd1fe"]]},{"id":"3d6981a7.3cd1fe","type":"function","z":"b53fc322.1dcb7","name":"Page","func":"rnd = Math.round(Math.random() *100)\nvar d = new Date(); // for now\nvar hour = d.getHours(); // => 9\nvar min = d.getMinutes(); // => 30\nif(hour < 10){\n hour = '0' + hour\n}\nif(min < 10){\n min = '0'+ min\n}\nmsg.payload = {'hours':hour,\n 'minutes':min,\n 'random':rnd\n}\nreturn msg","outputs":1,"noerr":0,"x":300,"y":420,"wires":[["422c7eb5.4e99a"]]},{"id":"422c7eb5.4e99a","type":"template","z":"b53fc322.1dcb7","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Time last server time request received at {{payload.hours}}:{{payload.minutes}}\nLast random number request returned {{payload.random}}, which was received at {{payload.hours}}:{{payload.minutes}}\n","output":"json","x":460,"y":420,"wires":[["bc5cd986.75d568"]]},{"id":"bc5cd986.75d568","type":"function","z":"b53fc322.1dcb7","name":"Header","func":"// If sending JSON data the content type is:\n//msg.headers={"Content-Type":"application/json"}\n\n// For HTML use the content type line below:\nmsg.headers={"Content-Type":"text/html"}\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":420,"wires":[["d686f052.15c9f"]]},{"id":"d686f052.15c9f","type":"http response","z":"b53fc322.1dcb7","name":"","statusCode":"","headers":{},"x":800,"y":420,"wires":}]

```

---

<div class="post-metadata">

**Author:** ![Umang](https://avatars.discourse-cdn.com/v4/letter/u/db5fbb/32.png) [@Umang](https://discourse.nodered.org/u/Umang)\
**Post date:** [20 March 2019 11:41 UTC](https://discourse.nodered.org/t/while-running-the-flow-getting-servet-time-out-error/9227/4 "2019-03-20T11:41:29Z")

</div>

System Windows10 but on Bluemix platform of IoT  
version v10.15.1  
and what does contrib mean and how do I check it??

---

<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:** [20 March 2019 11:47 UTC](https://discourse.nodered.org/t/while-running-the-flow-getting-servet-time-out-error/9227/5 "2019-03-20T11:47:48Z")

</div>

@Umang please re-export your flow and share it again. The original one you shared is not valid json, and I guess you copy and pasted it when reposting it - so it's still invalid.

A quick scan through your flow json I can see it is only use default nodes, so don't worry about the `contrib` question.

---

<div class="post-metadata">

**Author:** ![Umang](https://avatars.discourse-cdn.com/v4/letter/u/db5fbb/32.png) [@Umang](https://discourse.nodered.org/u/Umang)\
**Post date:** [20 March 2019 11:59 UTC](https://discourse.nodered.org/t/while-running-the-flow-getting-servet-time-out-error/9227/6 "2019-03-20T11:59:44Z")

</div>

```auto
[{"id":"2e661d86.fa8792","type":"http in","z":"b53fc322.1dcb7","name":"/time","url":"/time","method":"get","upload":false,"swaggerDoc":"","x":130,"y":220,"wires":[["8cd25dc8.9a8d9"]]},{"id":"8cd25dc8.9a8d9","type":"function","z":"b53fc322.1dcb7","name":"Time","func":"var d = new Date(); // for now\nvar hour = d.getHours(); // => 9\nvar min = d.getMinutes(); // => 30\nif(hour < 10){\n hour = '0' + hour\n}\nif(min < 10){\n min = '0'+ min\n}\nmsg.payload = {'hours':hour,\n 'minutes':min}\nreturn msg","outputs":1,"noerr":0,"x":300,"y":220,"wires":[["4205f606.514958"]]},{"id":"4205f606.514958","type":"template","z":"b53fc322.1dcb7","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Time last server time request received at {{payload.hours}}:{{payload.minutes}}\n","output":"str","x":460,"y":220,"wires":[["bf8f7c07.8cea1"]]},{"id":"bf8f7c07.8cea1","type":"function","z":"b53fc322.1dcb7","name":"Header","func":"// If sending JSON data the content type is:\n//msg.headers={\"Content-Type\":\"application/json\"}\n\n// For HTML use the content type line below:\nmsg.headers={\"Content-Type\":\"application/json\"}\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":220,"wires":[["2e1c54e0.51a52c"]]},{"id":"2e1c54e0.51a52c","type":"http response","z":"b53fc322.1dcb7","name":"","statusCode":"","headers":{},"x":800,"y":220,"wires":[]},{"id":"3e0356fa.dc088a","type":"http in","z":"b53fc322.1dcb7","name":"/random","url":"/random","method":"get","upload":false,"swaggerDoc":"","x":140,"y":300,"wires":[["d5c3b5fb.4cd768"]]},{"id":"d5c3b5fb.4cd768","type":"function","z":"b53fc322.1dcb7","name":"Random","func":"rnd = Math.round(Math.random() *100)\nvar d1 = new Date(); // for now\nvar hour1 = d1.getHours(); // => 9\nvar min1 = d1.getMinutes(); // => 30\nif(hour1 < 10){\n hour1 = '0' + hour1\n}\nif(min1 < 10){\n min1 = '0'+ min1\n}\nmsg.payload = {'random':rnd,\n 'hours':hour1,\n 'minutes':min1\n}\nreturn msg","outputs":1,"noerr":0,"x":300,"y":300,"wires":[["6c6d5d0f.ef2a54","422c7eb5.4e99a"]]},{"id":"6c6d5d0f.ef2a54","type":"template","z":"b53fc322.1dcb7","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Last random number request returned {{payload.random}}\n","output":"str","x":460,"y":300,"wires":[["728ae10a.d4914"]]},{"id":"7e5ccc8d.b85784","type":"http response","z":"b53fc322.1dcb7","name":"","statusCode":"","headers":{},"x":800,"y":300,"wires":[]},{"id":"572d0a8c.5f80b4","type":"http in","z":"b53fc322.1dcb7","name":"/page","url":"/page","method":"get","upload":false,"swaggerDoc":"","x":130,"y":360,"wires":[["3d6981a7.3cd1fe"]]},{"id":"3d6981a7.3cd1fe","type":"function","z":"b53fc322.1dcb7","name":"Page","func":"rnd = Math.round(Math.random() *100)\nvar d = new Date(); // for now\nvar hour = d.getHours(); // => 9\nvar min = d.getMinutes(); // => 30\nif(hour < 10){\n hour = '0' + hour\n}\nif(min < 10){\n min = '0'+ min\n}\nmsg.payload = {'hours':hour,\n 'minutes':min,\n 'random':rnd\n}\nreturn msg","outputs":1,"noerr":0,"x":300,"y":360,"wires":[["422c7eb5.4e99a"]]},{"id":"422c7eb5.4e99a","type":"template","z":"b53fc322.1dcb7","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Time last server time request received at {{payload.hours}}:{{payload.minutes}}\nLast random number request returned {{payload.random}}, which was received at {{payload.hours}}:{{payload.minutes}}\n","output":"str","x":460,"y":360,"wires":[["bc5cd986.75d568"]]},{"id":"bc5cd986.75d568","type":"function","z":"b53fc322.1dcb7","name":"Header","func":"// If sending JSON data the content type is:\n//msg.headers={\"Content-Type\":\"application/json\"}\n\n// For HTML use the content type line below:\nmsg.headers={\"Content-Type\":\"application/json\"}\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":360,"wires":[["d686f052.15c9f"]]},{"id":"d686f052.15c9f","type":"http response","z":"b53fc322.1dcb7","name":"","statusCode":"","headers":{},"x":800,"y":360,"wires":[]},{"id":"728ae10a.d4914","type":"function","z":"b53fc322.1dcb7","name":"Header","func":"// If sending JSON data the content type is:\n//msg.headers={\"Content-Type\":\"application/json\"}\n\n// For HTML use the content type line below:\nmsg.headers={\"Content-Type\":\"application/json\"}\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":300,"wires":[["7e5ccc8d.b85784"]]}]

```

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [20 March 2019 12:18 UTC](https://discourse.nodered.org/t/while-running-the-flow-getting-servet-time-out-error/9227/7 "2019-03-20T12:18:43Z")

</div>

Well all your flows run fine on my local machine, so it could be a bluemix issue...

---

<div class="post-metadata">

**Author:** ![Umang](https://avatars.discourse-cdn.com/v4/letter/u/db5fbb/32.png) [@Umang](https://discourse.nodered.org/u/Umang)\
**Post date:** [20 March 2019 12:31 UTC](https://discourse.nodered.org/t/while-running-the-flow-getting-servet-time-out-error/9227/8 "2019-03-20T12:31:56Z")

</div>

Actually now I am getting an error of Unexpected token T in JSON at position 0. I am needed to return a JSON document. So whats this Error I have no experience in JSON??

---

<div class="post-metadata">

**Author:** ![Umang](https://avatars.discourse-cdn.com/v4/letter/u/db5fbb/32.png) [@Umang](https://discourse.nodered.org/u/Umang)\
**Post date:** [20 March 2019 12:33 UTC](https://discourse.nodered.org/t/while-running-the-flow-getting-servet-time-out-error/9227/9 "2019-03-20T12:33:29Z")

</div>

Sir, this question is a part of task on Coursera course. But I am unable to get replies there So could you just help me a little.

---

<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:** [20 March 2019 12:37 UTC](https://discourse.nodered.org/t/while-running-the-flow-getting-servet-time-out-error/9227/10 "2019-03-20T12:37:15Z")

</div>

Thanks for sharing your flow.  
Yes, I see this is the Coursera assignment you've shared. Please remember the honour code you signed on joining the course regarding sharing solutions online.

> [@Umang](#):
>
> Actually now I am getting an error of Unexpected token T in JSON at position 0. I am needed to return a JSON document. So whats this Error I have no experience in JSON??

You don't say where you hit that error, so I'm not sure how we can help.

---

<div class="post-metadata">

**Author:** ![Umang](https://avatars.discourse-cdn.com/v4/letter/u/db5fbb/32.png) [@Umang](https://discourse.nodered.org/u/Umang)\
**Post date:** [21 March 2019 10:53 UTC](https://discourse.nodered.org/t/while-running-the-flow-getting-servet-time-out-error/9227/11 "2019-03-21T10:53:08Z")

</div>

The grader output shows following output as an error:  
Testing /page first load : SyntaxError: Unexpected token T in JSON at position 0.  
Testing /time : SyntaxError: Unexpected token T in JSON at position 0.  
Testing /random : SyntaxError: Unexpected token L in JSON at position 0
