# Why isnt my payload being displayed in the browser?

**URL:** <https://discourse.nodered.org/t/why-isnt-my-payload-being-displayed-in-the-browser/76813>\
**Category:** General\
**Tags:** opcua\
**Created:** [22 March 2023 11:06 UTC](https://discourse.nodered.org/t/why-isnt-my-payload-being-displayed-in-the-browser/76813 "2023-03-22T11:06:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![aqueousdan](https://avatars.discourse-cdn.com/v4/letter/a/2acd7d/32.png) [@aqueousdan](https://discourse.nodered.org/u/aqueousdan)\
**Post date:** [22 March 2023 11:06 UTC](https://discourse.nodered.org/t/why-isnt-my-payload-being-displayed-in-the-browser/76813/1 "2023-03-22T11:06:39Z")

</div>

Can anyone see what im missing here? When i load the page at 1270.0.01/t it starts the connection fine. I can see at my debug nodes that it is reading the values fine but when i load the browser i just see "The value of the payload is {}".

```auto
[
    {
        "id": "dfbe90bbe964e4a6",
        "type": "OpcUa-Item",
        "z": "b1cdb8634f302c96",
        "item": "ns=2;s=BAR-LIN-LINEH.PLC.CycleCount",
        "datatype": "Int32",
        "value": "",
        "name": "",
        "x": 500,
        "y": 320,
        "wires": [
            [
                "a57a83b1615a9e21"
            ]
        ]
    },
    {
        "id": "a57a83b1615a9e21",
        "type": "OpcUa-Client",
        "z": "b1cdb8634f302c96",
        "endpoint": "7290d8b0.f713d8",
        "action": "read",
        "deadbandvalue": "",
        "time": "5",
        "timeUnit": "s",
        "localfile": "",
        "localkeyfile": "",
        "folderName4PKI": "",
        "name": "Test server (subscribe items)",
        "x": 760,
        "y": 320,
        "wires": [
            [
                "5ccac9aebf6bc09d",
                "501da7f9abb42b8d"
            ]
        ]
    },
    {
        "id": "30507aab1156aa78",
        "type": "debug",
        "z": "b1cdb8634f302c96",
        "name": "debug 9",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1400,
        "y": 440,
        "wires": []
    },
    {
        "id": "649d958d3c688149",
        "type": "template",
        "z": "b1cdb8634f302c96",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "The value of the payload is {{payload}}",
        "output": "str",
        "x": 1240,
        "y": 520,
        "wires": [
            [
                "c3de8b5b0cbc7a70",
                "30507aab1156aa78"
            ]
        ]
    },
    {
        "id": "c3de8b5b0cbc7a70",
        "type": "http response",
        "z": "b1cdb8634f302c96",
        "name": "",
        "statusCode": "",
        "headers": {
            "content-type": "application/json"
        },
        "x": 1430,
        "y": 560,
        "wires": []
    },
    {
        "id": "5ccac9aebf6bc09d",
        "type": "json",
        "z": "b1cdb8634f302c96",
        "name": "",
        "property": "payload",
        "action": "",
        "pretty": false,
        "x": 1070,
        "y": 440,
        "wires": [
            [
                "649d958d3c688149"
            ]
        ]
    },
    {
        "id": "501da7f9abb42b8d",
        "type": "debug",
        "z": "b1cdb8634f302c96",
        "name": "debug 10",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1380,
        "y": 320,
        "wires": []
    },
    {
        "id": "573a1a7218909536",
        "type": "http in",
        "z": "b1cdb8634f302c96",
        "name": "",
        "url": "t",
        "method": "get",
        "upload": false,
        "swaggerDoc": "",
        "x": 370,
        "y": 640,
        "wires": [
            [
                "dfbe90bbe964e4a6",
                "5ccac9aebf6bc09d"
            ]
        ]
    },
    {
        "id": "7290d8b0.f713d8",
        "type": "OpcUa-Endpoint",
        "endpoint": "opc.tcp://10.50.66.175:49320",
        "none": false,
        "login": false,
        "usercert": false,
        "usercertificate": "",
        "userprivatekey": ""
    }
]

```

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [22 March 2023 11:09 UTC](https://discourse.nodered.org/t/why-isnt-my-payload-being-displayed-in-the-browser/76813/2 "2023-03-22T11:09:54Z")

</div>

Remove this wire.  
you are responding to the request before it travels through your opcua nodes

(I think 😅 )

As long as the HTTP Response node is at the end of the line  
(and importantly, you don't re-declare `msg` anywhere) it will respond with the payload that has been picked up on the way)

 ![Screenshot 2023-03-22 at 11.08.55](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/f/dfce000b64ba7e62ada0b8dfd4c1a49e17245bab.png)

---

<div class="post-metadata">

**Author:** ![aqueousdan](https://avatars.discourse-cdn.com/v4/letter/a/2acd7d/32.png) [@aqueousdan](https://discourse.nodered.org/u/aqueousdan)\
**Post date:** [22 March 2023 11:43 UTC](https://discourse.nodered.org/t/why-isnt-my-payload-being-displayed-in-the-browser/76813/3 "2023-03-22T11:43:54Z")

</div>

Thanks for your reply.  
When i remove this wire, my page never loads. just sits there loading. Not really sure why.

looking in the node-red cmd window i get the message

22 Mar 11:44:31 - [error] [http response:c3de8b5b0cbc7a70] RangeError [ERR\_HTTP\_INVALID\_STATUS\_CODE]: Invalid status code: Good (0x00000000)

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [22 March 2023 11:52 UTC](https://discourse.nodered.org/t/why-isnt-my-payload-being-displayed-in-the-browser/76813/4 "2023-03-22T11:52:54Z")

</div>

Try

All I have done is set the status code

```auto
[{"id":"dfbe90bbe964e4a6","type":"OpcUa-Item","z":"0f37a6818e63a54f","item":"ns=2;s=BAR-LIN-LINEH.PLC.CycleCount","datatype":"Int32","value":"","name":"","x":280,"y":210,"wires":[["a57a83b1615a9e21"]]},{"id":"a57a83b1615a9e21","type":"OpcUa-Client","z":"0f37a6818e63a54f","endpoint":"7290d8b0.f713d8","action":"read","deadbandvalue":"","time":"5","timeUnit":"s","localfile":"","localkeyfile":"","folderName4PKI":"","name":"Test server (subscribe items)","x":290,"y":290,"wires":[["5ccac9aebf6bc09d","501da7f9abb42b8d"]]},{"id":"c3de8b5b0cbc7a70","type":"http response","z":"0f37a6818e63a54f","name":"","statusCode":"200","headers":{"content-type":"application/json"},"x":660,"y":350,"wires":[]},{"id":"5ccac9aebf6bc09d","type":"json","z":"0f37a6818e63a54f","name":"","property":"payload","action":"","pretty":false,"x":465,"y":350,"wires":[["c3de8b5b0cbc7a70"]]},{"id":"501da7f9abb42b8d","type":"debug","z":"0f37a6818e63a54f","name":"debug 10","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":660,"y":290,"wires":[]},{"id":"573a1a7218909536","type":"http in","z":"0f37a6818e63a54f","name":"","url":"t","method":"get","upload":false,"swaggerDoc":"","x":80,"y":210,"wires":[["dfbe90bbe964e4a6"]]}]

```

---

<div class="post-metadata">

**Author:** ![aqueousdan](https://avatars.discourse-cdn.com/v4/letter/a/2acd7d/32.png) [@aqueousdan](https://discourse.nodered.org/u/aqueousdan)\
**Post date:** [22 March 2023 12:15 UTC](https://discourse.nodered.org/t/why-isnt-my-payload-being-displayed-in-the-browser/76813/5 "2023-03-22T12:15:14Z")

</div>

That works great thankyou. I think i better read about statuscodes. Not sure why that makes it work. Thankyou for your assistance sir!

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [22 March 2023 12:19 UTC](https://discourse.nodered.org/t/why-isnt-my-payload-being-displayed-in-the-browser/76813/6 "2023-03-22T12:19:29Z")

</div>

Below is the list of HTTP Response codes - we used **200**

| Code | Constant | Reason Phrase |
| --- | --- | --- |
| 100 | CONTINUE | Continue |
| 101 | SWITCHING\_PROTOCOLS | Switching Protocols |
| 102 | PROCESSING | Processing |
| 200 | OK | OK |
| 201 | CREATED | Created |
| 202 | ACCEPTED | Accepted |
| 203 | NON\_AUTHORITATIVE\_INFORMATION | Non Authoritative Information |
| 204 | NO\_CONTENT | No Content |
| 205 | RESET\_CONTENT | Reset Content |
| 206 | PARTIAL\_CONTENT | Partial Content |
| 207 | MULTI\_STATUS | Multi-Status |
| 300 | MULTIPLE\_CHOICES | Multiple Choices |
| 301 | MOVED\_PERMANENTLY | Moved Permanently |
| 302 | MOVED\_TEMPORARILY | Moved Temporarily |
| 303 | SEE\_OTHER | See Other |
| 304 | NOT\_MODIFIED | Not Modified |
| 305 | USE\_PROXY | Use Proxy |
| 307 | TEMPORARY\_REDIRECT | Temporary Redirect |
| 308 | PERMANENT\_REDIRECT | Permanent Redirect |
| 400 | BAD\_REQUEST | Bad Request |
| 401 | UNAUTHORIZED | Unauthorized |
| 402 | PAYMENT\_REQUIRED | Payment Required |
| 403 | FORBIDDEN | Forbidden |
| 404 | NOT\_FOUND | Not Found |
| 405 | METHOD\_NOT\_ALLOWED | Method Not Allowed |
| 406 | NOT\_ACCEPTABLE | Not Acceptable |
| 407 | PROXY\_AUTHENTICATION\_REQUIRED | Proxy Authentication Required |
| 408 | REQUEST\_TIMEOUT | Request Timeout |
| 409 | CONFLICT | Conflict |
| 410 | GONE | Gone |
| 411 | LENGTH\_REQUIRED | Length Required |
| 412 | PRECONDITION\_FAILED | Precondition Failed |
| 413 | REQUEST\_TOO\_LONG | Request Entity Too Large |
| 414 | REQUEST\_URI\_TOO\_LONG | Request-URI Too Long |
| 415 | UNSUPPORTED\_MEDIA\_TYPE | Unsupported Media Type |
| 416 | REQUESTED\_RANGE\_NOT\_SATISFIABLE | Requested Range Not Satisfiable |
| 417 | EXPECTATION\_FAILED | Expectation Failed |
| 418 | IM\_A\_TEAPOT | I'm a teapot |
| 419 | INSUFFICIENT\_SPACE\_ON\_RESOURCE | Insufficient Space on Resource |
| 420 | METHOD\_FAILURE | Method Failure |
| 421 | MISDIRECTED\_REQUEST | Misdirected Request |
| 422 | UNPROCESSABLE\_ENTITY | Unprocessable Entity |
| 423 | LOCKED | Locked |
| 424 | FAILED\_DEPENDENCY | Failed Dependency |
| 428 | PRECONDITION\_REQUIRED | Precondition Required |
| 429 | TOO\_MANY\_REQUESTS | Too Many Requests |
| 431 | REQUEST\_HEADER\_FIELDS\_TOO\_LARGE | Request Header Fields Too Large |
| 451 | UNAVAILABLE\_FOR\_LEGAL\_REASONS | Unavailable For Legal Reasons |
| 500 | INTERNAL\_SERVER\_ERROR | Internal Server Error |
| 501 | NOT\_IMPLEMENTED | Not Implemented |
| 502 | BAD\_GATEWAY | Bad Gateway |
| 503 | SERVICE\_UNAVAILABLE | Service Unavailable |
| 504 | GATEWAY\_TIMEOUT | Gateway Timeout |
| 505 | HTTP\_VERSION\_NOT\_SUPPORTED | HTTP Version Not Supported |
| 507 | INSUFFICIENT\_STORAGE | Insufficient Storage |
| 511 | NETWORK\_AUTHENTICATION\_REQUIRED | Network Authentication Required |

---

<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:** [21 May 2023 12:20 UTC](https://discourse.nodered.org/t/why-isnt-my-payload-being-displayed-in-the-browser/76813/7 "2023-05-21T12:20:09Z")

</div>

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