thin-edge / thin-edge.io

The open edge framework for lightweight IoT devices
https://thin-edge.io
Apache License 2.0
221 stars 54 forks source link

large failure reason text corrupts the 502 message when setting operation status to FAILED #2567

Closed reubenmiller closed 9 months ago

reubenmiller commented 9 months ago

Describe the bug

When a custom Cumulocity IoT operation fails and there a large standard error output greater than the max MQTT message size, then it results in an ill-formed SmartREST message as the failure reason quote is not terminated:

For example, a 502 SmartREST message is sent where only the opening quote is included in the failure reason (e.g. the 3rd field of the CSV text).

[c8y/s/us] 502,c8y_NodeRed,"long failure reason....

To Reproduce

  1. Use the c8y-command-plugin (which provides the c8y_Command operation handler)
  2. Create a Shell Operation via the Device Managment Application which generates at least 17000 characters on the Standard Error stream (stderr)
  3. Check the operation status in the UI and view that it is "stuck" in the EXECUTING state

Expected behavior

Long failure reasons are generally not that helpful as it causes visualization problems in UIs and is anyway unreadable.

The following are the suggested rules to apply to the failure reason handling:

Screenshots

Environment (please complete the following information):

Property Value
OS [incl. version] Debian GNU/Linux 12 (bookworm)
Hardware [incl. revision] unknown
System-Architecture Linux f28a6f153954 6.5.0-10-generic #10-Ubuntu SMP PREEMPT_DYNAMIC Fri Oct 13 18:28:22 UTC 2023 aarch64 GNU/Linux
thin-edge.io version tedge 1.0.0-rc.1

Additional context

Below shows the subscription to the c8y/# topic where the error was spotted:

tedge mqtt sub 'c8y/#'
[c8y/s/us] 501,c8y_NodeRed
[c8y/s/us] 502,c8y_NodeRed,"2024-01-05 14:38:14,806 - c8y_NodeRed - ERROR - Aborting due to error: 400 Client Error: Bad Request for url: http://localhost:1880/flow

2024-01-05 14:38:14,761 - c8y_NodeRed - DEBUG - Received the following data: 10,c8y_nodered_manager_001,ewogICAgImlkIjogIjJjMWMwNTJkMzY0NGUwMGIiLAogICAgImxhYmVsIjogIlRlbXBlcmF0dXJlIEZsb3ciLAogICAgImRpc2FibGVkIjogZmFsc2UsCiAgICAiaW5mbyI6ICIiLAogICAgImVudiI6IFtdLAogICAgIm5vZGVzIjogWwogICAgICAgIHsKICAgICAgICAgICAgImlkIjogIjJjMWMwNTJkMzY0NGUwMGIiLAogICAgICAgICAgICAidHlwZSI6ICJ0YWIiLAogICAgICAgICAgICAibGFiZWwiOiAiVGVtcGVyYXR1cmUgRmxvdyIsCiAgICAgICAgICAgICJkaXNhYmxlZCI6IGZhbHNlLAogICAgICAgICAgICAiaW5mbyI6ICIiLAogICAgICAgICAgICAiZW52IjogW10KICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImlkIjogImY2Y2YxNGU3Y2Y1OGMwYjgiLAogICAgICAgICAgICAidHlwZSI6ICJtcXR0LWJyb2tlciIsCiAgICAgICAgICAgICJuYW1lIjogIiIsCiAgICAgICAgICAgICJicm9rZXIiOiAiMTI3LjAuMC4xIiwKICAgICAgICAgICAgInBvcnQiOiAiMTg4MyIsCiAgICAgICAgICAgICJjbGllbnRpZCI6ICJub2RlcmVkIiwKICAgICAgICAgICAgImF1dG9Db25uZWN0IjogdHJ1ZSwKICAgICAgICAgICAgInVzZXRscyI6IGZhbHNlLAogICAgICAgICAgICAicHJvdG9jb2xWZXJzaW9uIjogIjQiLAogICAgICAgICAgICAia2VlcGFsaXZlIjogIjYwIiwKICAgICAgICAgICAgImNsZWFuc2Vzc2lvbiI6IGZhbHNlLAogICAgICAgICAgICAiYXV0b1Vuc3Vic2NyaWJlIjogdHJ1ZSwKICAgICAgICAgICAgImJpcnRoVG9waWMiOiAidGUvZGV2aWNlL21haW4vc2VydmljZS9ub2RlcmVkLXRlbXBlcmF0dXJlLWZsb3ciLAogICAgICAgICAgICAiYmlydGhRb3MiOiAiMSIsCiAgICAgICAgICAgICJiaXJ0aFJldGFpbiI6ICJ0cnVlIiwKICAgICAgICAgICAgImJpcnRoUGF5bG9hZCI6ICJ7XCJAdHlwZVwiOlwic2VydmljZVwiLFwiQHBhcmVudFwiOlwiZGV2aWNlL21haW4vL1wiLFwidHlwZVwiOlwibm9kZXJlZFwifSIsCiAgICAgICAgICAgICJiaXJ0aE1zZyI6IHt9LAogICAgICAgICAgICAiY2xvc2VUb3BpYyI6ICJ0ZS9kZXZpY2UvbWFpbi9zZXJ2aWNlL25vZGVyZWQtdGVtcGVyYXR1cmUtZmxvdy9zdGF0dXMvaGVhbHRoIiwKICAgICAgICAgICAgImNsb3NlUW9zIjogIjEiLAogICAgICAgICAgICAiY2xvc2VSZXRhaW4iOiAidHJ1ZSIsCiAgICAgICAgICAgICJjbG9zZVBheWxvYWQiOiAie1wic3RhdHVzXCI6XCJkb3duXCJ9IiwKICAgICAgICAgICAgImNsb3NlTXNnIjoge30sCiAgICAgICAgICAgICJ3aWxsVG9waWMiOiAidGUvZGV2aWNlL21haW4vc2VydmljZS9ub2RlcmVkLXRlbXBlcmF0dXJlLWZsb3cvc3RhdHVzL2hlYWx0aCIsCiAgICAgICAgICAgICJ3aWxsUW9zIjogIjEiLAogICAgICAgICAgICAid2lsbFJldGFpbiI6ICJ0cnVlIiwKICAgICAgICAgICAgIndpbGxQYXlsb2FkIjogIntcInN0YXR1c1wiOlwiZG93blwifSIsCiAgICAgICAgICAgICJ3aWxsTXNnIjoge30sCiAgICAgICAgICAgICJ1c2VyUHJvcHMiOiAiIiwKICAgICAgICAgICAgInNlc3Npb25FeHBpcnkiOiAiIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiaWQiOiAiMmNlNzgwMDY5MzEzMDRhYyIsCiAgICAgICAgICAgICJ0eXBlIjogIm1xdHQgaW4iLAogICAgICAgICAgICAieiI6ICIyYzFjMDUyZDM2NDRlMDBiIiwKICAgICAgICAgICAgIm5hbWUiOiAidGVkZ2UgdGVtcGVyYXR1cmUgbWVhc3VyZW1lbnRzIiwKICAgICAgICAgICAgInRvcGljIjogInRlL2RldmljZS9tYWluLy8vbS8rIiwKICAgICAgICAgICAgInFvcyI6ICIwIiwKICAgICAgICAgICAgImRhdGF0eXBlIjogImpzb24iLAogICAgICAgICAgICAiYnJva2VyIjogImY2Y2YxNGU3Y2Y1OGMwYjgiLAogICAgICAgICAgICAibmwiOiBmYWxzZSwKICAgICAgICAgICAgInJhcCI6IHRydWUsCiAgICAgICAgICAgICJyaCI6IDAsCiAgICAgICAgICAgICJpbnB1dHMiOiAwLAogICAgICAgICAgICAieCI6IDI0MCwKICAgICAgICAgICAgInkiOiAzMDAsCiAgICAgICAgICAgICJ3aXJlcyI6IFsKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAiNjkyMDlmYTgzNmQ3YzRhNiIKICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgXQogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiaWQiOiAiZTgwOTc3MTUzYjUwYmYxZCIsCiAgICAgICAgICAgICJ0eXBlIjogIm1xdHQgb3V0IiwKICAgICAgICAgICAgInoiOiAiMmMxYzA1MmQzNjQ0ZTAwYiIsCiAgICAgICAgICAgICJuYW1lIjogIlB1Ymxpc2ggZXZlbnQiLAogICAgICAgICAgICAidG9waWMiOiAidGUvZGV2aWNlL21haW4vLy9lL3RlbXBlcmF0dXJlQ2hhbmdlIiwKICAgICAgICAgICAgInFvcyI6ICIyIiwKICAgICAgICAgICAgInJldGFpbiI6ICJmYWxzZSIsCiAgICAgICAgICAgICJyZXNwVG9waWMiOiAiIiwKICAgICAgICAgICAgImNvbnRlbnRUeXBlIjogIiIsCiAgICAgICAgICAgICJ1c2VyUHJvcHMiOiAiIiwKICAgICAgICAgICAgImNvcnJlbCI6ICIiLAogICAgICAgICAgICAiZXhwaXJ5IjogIiIsCiAgICAgICAgICAgICJicm9rZXIiOiAiZjZjZjE0ZTdjZjU4YzBiOCIsCiAgICAgICAgICAgICJ4IjogMTA0MCwKICAgICAgICAgICAgInkiOiAzMDAsCiAgICAgICAgICAgICJ3aXJlcyI6IFtdCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJpZCI6ICI2OTIwOWZhODM2ZDdjNGE2IiwKICAgICAgICAgICAgInR5cGUiOiAicmJlIiwKICAgICAgICAgICAgInoiOiAiMmMxYzA1MmQzNjQ0ZTAwYiIsCiAgICAgICAgICAgICJuYW1lIjogInNpZ25pZmljYW50IHRlbXBlcmF0dXJlIGNoYW5nZSIsCiAgICAgICAgICAgICJmdW5jIjogImRlYWRiYW5kRXEiLAogICAgICAgICAgICAiZ2FwIjogIjEwIiwKICAgICAgICAgICAgInN0YXJ0IjogIiIsCiAgICAgICAgICAgICJpbm91dCI6ICJpbiIsCiAgICAgICAgICAgICJzZXB0b3BpY3MiOiBmYWxzZSwKICAgICAgICAgICAgInByb3BlcnR5IjogInBheWxvYWQudGVtcGVyYXR1cmUiLAogICAgICAgICAgICAidG9waSI6ICJ0b3BpYyIsCiAgICAgICAgICAgICJ4IjogNTcwLAogICAgICAgICAgICAieSI6IDMwMCwKICAgICAgICAgICAgIndpcmVzIjogWwogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICIwODBiYmRjN2IyM2JjMzRkIgogICAgICAgICAgICAgICAgXQogICAgICAgICAgICBdCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJpZCI6ICIwODBiYmRjN2IyM2JjMzRkIiwKICAgICAgICAgICAgInR5cGUiOiAidGVtcGxhdGUiLAogICAgICAgICAgICAieiI6ICIyYzFjMDUyZDM2NDRlMDBiIiwKICAgICAgICAgICAgIm5hbWUiOiAiQ3JlYXRlIEV2ZW50IiwKICAgICAgICAgICAgImZpZWxkIjogInBheWxvYWQiLAogICAgICAgICAgICAiZmllbGRUeXBlIjogIm1zZyIsCiAgICAgICAgICAgICJmb3JtYXQiOiAiaGFuZGxlYmFycyIsCiAgICAgICAgICAgICJzeW50YXgiOiAibXVzdGFjaGUiLAogICAgICAgICAgICAidGVtcGxhdGUiOiAie1widGV4dFwiOiBcIlRlbXBlcmF0dXJlIGNoYW5nZWQgYnkg4omlMTDCsEMuIG5ld192YWx1ZT17e3BheWxvYWQudGVtcGVyYXR1cmV9fcKwQ1wifSIsCiAgICAgICAgICAgICJvdXRwdXQiOiAianNvbiIsCiAgICAgICAgICAgICJ4IjogODMwLAogICAgICAgICAgICAieSI6IDMwMCwKICAgICAgICAgICAgIndpcmVzIjogWwogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICJlODA5NzcxNTNiNTBiZjFkIgogICAgICAgICAgICAgICAgXQogICAgICAgICAgICBdCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJpZCI6ICIyMzY1MDNmOGQyNGNmNjA3IiwKICAgICAgICAgICAgInR5cGUiOiAibXF0dCBvdXQiLAogICAgICAgICAgICAieiI6ICIyYzFjMDUyZDM2NDRlMDBiIiwKICAgICAgICAgICAgIm5hbWUiOiAiUHVibGlzaCBoZWFsdGgiLAogICAgICAgICAgICAidG9waWMiOiAidGUvZGV2aWNlL21haW4vc2VydmljZS9ub2RlcmVkLXRlbXBlcmF0dXJlLWZsb3cvc3RhdHVzL2hlYWx0aCIsCiAgICAgICAgICAgICJxb3MiOiAiMiIsCiAgICAgICAgICAgICJyZXRhaW4iOiAidHJ1ZSIsCiAgICAgICAgICAgICJyZXNwVG9waWMiOiAiIiwKICAgICAgICAgICAgImNvbnRlbnRUeXBlIjogIiIsCiAgICAgICAgICAgICJ1c2VyUHJvcHMiOiAiIiwKICAgICAgICAgICAgImNvcnJlbCI6ICIiLAogICAgICAgICAgICAiZXhwaXJ5IjogIiIsCiAgICAgICAgICAgICJicm9rZXIiOiAiZjZjZjE0ZTdjZjU4YzBiOCIsCiAgICAgICAgICAgICJ4IjogNDAwLAogICAgICAgICAgICAieSI6IDE4MCwKICAgICAgICAgICAgIndpcmVzIjogW10KICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImlkIjogImQ0MDc4NjYwOWU4MTk3ZWYiLAogICAgICAgICAgICAidHlwZSI6ICJpbmplY3QiLAogICAgICAgICAgICAieiI6ICIyYzFjMDUyZDM2NDRlMDBiIiwKICAgICAgICAgICAgIm5hbWUiOiAiT24gU3RhcnR1cCIsCiAgICAgICAgICAgICJwcm9wcyI6IFsKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAicCI6ICJwYXlsb2FkIgogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAicCI6ICJ0b3BpYyIsCiAgICAgICAgICAgICAgICAgICAgInZ0IjogInN0ciIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgXSwKICAgICAgICAgICAgInJlcGVhdCI6ICIiLAogICAgICAgICAgICAiY3JvbnRhYiI6ICIiLAogICAgICAgICAgICAib25jZSI6IHRydWUsCiAgICAgICAgICAgICJvbmNlRGVsYXkiOiAiMiIsCiAgICAgICAgICAgICJ0b3BpYyI6ICJ0ZS9kZXZpY2UvbWFpbi9zZXJ2aWNlL25vZGVyZWQtdGVtcGVyYXR1cmUtZmxvdy9zdGF0dXMvaGVhbHRoIiwKICAgICAgICAgICAgInBheWxvYWQiOiAie1wic3RhdHVzXCI6XCJ1cFwifSIsCiAgICAgICAgICAgICJwYXlsb2FkVHlwZSI6ICJqc29uIiwKICAgICAgICAgICAgIngiOiAxNzAsCiAgICAgICAgICAgICJ5IjogMTgwLAogICAgICAgICAgICAid2lyZXMiOiBbCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgIjIzNjUwM2Y4ZDI0Y2Y2MDciCiAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdCn0=,create,,
2024-01-05 14:38:14,761 - root - DEBUG - Processing message: NodeREDMessage(label='', data='{\n    ""id"": ""2c1c052d3644e00b"",\n    ""label"": ""Temperature Flow"",\n    ""disabled"": false,\n    ""info"": """",\n    ""env"": [],\n    ""nodes"": [\n        {\n            ""id"": ""2c1c052d3644e00b"",\n            ""type"": ""tab"",\n            ""label"": ""Temperature Flow"",\n            ""disabled"": false,\n            ""info"": """",\n            ""env"": []\n        },\n        {\n            ""id"": ""f6cf14e7cf58c0b8"",\n            ""type"": ""mqtt-broker"",\n            ""name"": """",\n            ""broker"": ""127.0.0.1"",\n            ""port"": ""1883"",\n            ""clientid"": ""nodered"",\n            ""autoConnect"": true,\n            ""usetls"": false,\n            ""protocolVersion"": ""4"",\n            ""keepalive"": ""60"",\n            ""cleansession"": false,\n            ""autoUnsubscribe"": true,\n            ""birthTopic"": ""te/device/main/service/nodered-temperature-flow"",\n            ""birthQos"": ""1"",\n            ""birthRetain"": ""true"",\n            ""birthPayload"": ""{\\""@type\\"":\\""service\\"",\\""@parent\\"":\\""device/main//\\"",\\""type\\"":\\""nodered\\""}"",\n            ""birthMsg"": {},\n            ""closeTopic"": ""te/device/main/service/nodered-temperature-flow/status/health"",\n            ""closeQos"": ""1"",\n            ""closeRetain"": ""true"",\n            ""closePayload"": ""{\\""status\\"":\\""down\\""}"",\n            ""closeMsg"": {},\n            ""willTopic"": ""te/device/main/service/nodered-temperature-flow/status/health"",\n            ""willQos"": ""1"",\n            ""willRetain"": ""true"",\n            ""willPayload"": ""{\\""status\\"":\\""down\\""}"",\n            ""willMsg"": {},\n            ""userProps"": """",\n            ""sessionExpiry"": """"\n        },\n        {\n            ""id"": ""2ce78006931304ac"",\n            ""type"": ""mqtt in"",\n            ""z"": ""2c1c052d3644e00b"",\n            ""name"": ""tedge temperature measurements"",\n            ""topic"": ""te/device/main///m/+"",\n            ""qos"": ""0"",\n            ""datatype"": ""json"",\n            ""broker"": ""f6cf14e7cf58c0b8"",\n            ""nl"": false,\n            ""rap"": true,\n            ""rh"": 0,\n            ""inputs"": 0,\n            ""x"": 240,\n            ""y"": 300,\n            ""wires"": [\n                [\n                    ""69209fa836d7c4a6""\n                ]\n            ]\n        },\n        {\n            ""id"": ""e80977153b50bf1d"",\n            ""type"": ""mqtt out"",\n            ""z"": ""2c1c052d3644e00b"",\n            ""name"": ""Publish event"",\n            ""topic"": ""te/device/main///e/temperatureChange"",\n            ""qos"": ""2"",\n            ""retain"": ""false"",\n            ""respTopic"": """",\n            ""contentType"": """",\n            ""userProps"": """",\n            ""correl"": """",\n            ""expiry"": """",\n            ""broker"": ""f6cf14e7cf58c0b8"",\n            ""x"": 1040,\n            ""y"": 300,\n            ""wires"": []\n        },\n        {\n            ""id"": ""69209fa836d7c4a6"",\n            ""type"": ""rbe"",\n            ""z"": ""2c1c052d3644e00b"",\n            ""name"": ""significant temperature change"",\n            ""func"": ""deadbandEq"",\n            ""gap"": ""10"",\n            ""start"": """",\n            ""inout"": ""in"",\n            ""septopics"": false,\n            ""property"": ""payload.temperature"",\n            ""topi"": ""topic"",\n            ""x"": 570,\n            ""y"": 300,\n            ""wires"": [\n                [\n                    ""080bbdc7b23bc34d""\n                ]\n            ]\n        },\n        {\n            ""id"": ""080bbdc7b23bc34d"",\n            ""type"": ""template"",\n            ""z"": ""2c1c052d3644e00b"",\n            ""name"": ""Create Event"",\n            ""field"": ""payload"",\n            ""fieldType"": ""msg"",\n            ""format"": ""handlebars"",\n            ""syntax"": ""mustache"",\n            ""template"": ""{\\""text\\"": \\""Temperature changed by ≥10°C. new_value={{payload.temperature}}°C\\""}"",\n            ""output"": ""json"",\n            ""x"": 830,\n            ""y"": 300,\n            ""wires"": [\n                [\n                    ""e80977153b50bf1d""\n                ]\n            ]\n        },\n        {\n            ""id"": ""236503f8d24cf607"",\n            ""type"": ""mqtt out"",\n            ""z"": ""2c1c052d3644e00b"",\n            ""name"": ""Publish health"",\n            ""topic"": ""te/device/main/service/nodered-temperature-flow/status/health"",\n            ""qos"": ""2"",\n            ""retain"": ""true"",\n            ""respTopic"": """",\n            ""contentType"": """",\n            ""userProps"": """",\n            ""correl"": """",\n            ""expiry"": """",\n            ""broker"": ""f6cf14e7cf58c0b8"",\n            ""x"": 400,\n            ""y"": 180,\n            ""wires"": []\n        },\n        {\n            ""id"": ""d40786609e8197ef"",\n            ""type"": ""inject"",\n            ""z"": ""2c1c052d3644e00b"",\n            ""name"": ""On Startup"",\n            ""props"": [\n                {\n                    ""p"": ""payload""\n                },\n                {\n                    ""p"": ""topic"",\n                    ""vt"": ""str""\n                }\n            ],\n            ""repeat"": """",\n            ""crontab"": """",\n            ""once"": true,\n            ""onceDelay"": ""2"",\n            ""topic"": ""te/device/main/service/nodered-temperature-flow/status/health"",\n            ""payload"": ""{\\""status\\"":\\""up\\""}"",\n            ""payloadType"": ""json"",\n            ""x"": 170,\n            ""y"": 180,\n            ""wires"": [\n                [\n                    ""236503f8d24cf607""\n                ]\n            ]\n        }\n    ]\n}', action='create', local_flow_id='', c8y_flow_id='')
2024-01-05 14:38:14,761 - root - DEBUG - Using the following url: http://localhost:1880
2024-01-05 14:38:14,761 - c8y_NodeRed - DEBUG - Checking if node-red is running locally
2024-01-05 14:38:14,761 - c8y_NodeRed - DEBUG - Checking whether node-red is running
2024-01-05 14:38:14,761 - c8y_NodeRed - DEBUG - Checking auth endpoint on /auth/login
2024-01-05 14:38:14,762 - urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): localhost:1880
2024-01-05 14:38:14,789 - urllib3.connectionpool - DEBUG - http://localhost:1880 ""GET /auth/login HTTP/1.1"" 200 2
2024-01-05 14:38:14,789 - c8y_NodeRed - DEBUG - Response from request: {}
2024-01-05 14:38:14,789 - c8y_NodeRed - DEBUG - Response from request with code: 200
2024-01-05 14:38:14,789 - c8y_NodeRed - INFO - Node-red is running
2024-01-05 14:38:14,789 - c8y_NodeRed - INFO - FlowId does not exist, creating it
2024-01-05 14:38:14,789 - c8y_NodeRed - DEBUG - Creating the flow with following data: {
    ""id"": ""2c1c052d3644e00b"",
    ""label"": ""Temperature Flow"",
    ""disabled"": false,
    ""info"": """",
    ""env"": [],
    ""nodes"": [
        {
            ""id"": ""2c1c052d3644e00b"",
            ""type"": ""tab"",
            ""label"": ""Temperature Flow"",
            ""disabled"": false,
            ""info"": """",
            ""env"": []
        },
        {
            ""id"": ""f6cf14e7cf58c0b8"",
            ""type"": ""mqtt-broker"",
            ""name"": """",
            ""broker"": ""127.0.0.1"",
            ""port"": ""1883"",
            ""clientid"": ""nodered"",
            ""autoConnect"": true,
            ""usetls"": false,
            ""protocolVersion"": ""4"",
            ""keepalive"": ""60"",
            ""cleansession"": false,
            ""autoUnsubscribe"": true,
            ""birthTopic"": ""te/device/main/service/nodered-temperature-flow"",
            ""birthQos"": ""1"",
            ""birthRetain"": ""true"",
            ""birthPayload"": ""{\""@type\"":\""service\"",\""@parent\"":\""device/main//\"",\""type\"":\""nodered\""}"",
            ""birthMsg"": {},
            ""closeTopic"": ""te/device/main/service/nodered-temperature-flow/status/health"",
            ""closeQos"": ""1"",
            ""closeRetain"": ""true"",
            ""closePayload"": ""{\""status\"":\""down\""}"",
            ""closeMsg"": {},
            ""willTopic"": ""te/device/main/service/nodered-temperature-flow/status/health"",
            ""willQos"": ""1"",
            ""willRetain"": ""true"",
            ""willPayload"": ""{\""status\"":\""down\""}"",
            ""willMsg"": {},
            ""userProps"": """",
            ""sessionExpiry"": """"
        },
        {
            ""id"": ""2ce78006931304ac"",
            ""type"": ""mqtt in"",
            ""z"": ""2c1c052d3644e00b"",
            ""name"": ""tedge temperature measurements"",
            ""topic"": ""te/device/main///m/+"",
            ""qos"": ""0"",
            ""datatype"": ""json"",
            ""broker"": ""f6cf14e7cf58c0b8"",
            ""nl"": false,
            ""rap"": true,
            ""rh"": 0,
            ""inputs"": 0,
            ""x"": 240,
            ""y"": 300,
            ""wires"": [
                [
                    ""69209fa836d7c4a6""
                ]
            ]
        },
        {
            ""id"": ""e80977153b50bf1d"",
            ""type"": ""mqtt out"",
            ""z"": ""2c1c052d3644e00b"",
            ""name"": ""Publish event"",
            ""topic"": ""te/device/main///e/temperatureCha"
Ruadhri17 commented 9 months ago

The solution was implemented according to the second suggestion in this ticket, i.e. if a failure reason is longer than 500 bytes, truncate it and warn the user about it. The easiest way to test this solution is to use c8y-command-plugin and force non-zero exit code with long (>500 bytes) error message.

gligorisaev commented 9 months ago

QA has thoroughly checked the bug and here are the results: