Protobuf encoder returns empty buffer payload (2)

I still fail to get the encoder to work.
I have read the first post. Still no joy.

the solution presented is msg.payload={payload:{....}}

I still get payload:buffer[0] in the debug node

Welcome to the forum @Highlander

Please add a debug node showing what you are sending to the node, expand the contents in the debug pane and paste it here.

Flow...

[
    {
        "id": "d834d19711c19ca1",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": ""
    },
    {
        "id": "81b70c550e599623",
        "type": "inject",
        "z": "d834d19711c19ca1",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "protobufType",
                "v": "Request",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"Request\":{\"has_id\":true,\"id\":35123456123456,\"location_count\":2,\"locations\":[{\"time\":0,\"latitude\":0,\"longitude\":0},{\"time\":10,\"latitude\":0.1,\"longitude\":0.1}]}}",
        "payloadType": "json",
        "x": 460,
        "y": 530,
        "wires": [
            [
                "a090e55a694af973",
                "90277ec091af9456"
            ]
        ]
    },
    {
        "id": "c5f63b690b5d79de",
        "type": "debug",
        "z": "d834d19711c19ca1",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 880,
        "y": 530,
        "wires": []
    },
    {
        "id": "a090e55a694af973",
        "type": "debug",
        "z": "d834d19711c19ca1",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 680,
        "y": 480,
        "wires": []
    },
    {
        "id": "90277ec091af9456",
        "type": "encode",
        "z": "d834d19711c19ca1",
        "name": "Request",
        "protofile": "fe99114ba64e9057",
        "protoType": "Request",
        "x": 690,
        "y": 530,
        "wires": [
            [
                "c5f63b690b5d79de"
            ]
        ]
    },
    {
        "id": "fe99114ba64e9057",
        "type": "protobuf-file",
        "protopath": "c:\\Temp\\proto\\test-proto2.proto",
        "watchFile": true
    }
]

test-proto2.proto

syntax = "proto2";

message Request {
    // Device's unique id
    optional fixed64 id = 1;

    repeated Location locations = 200;

    message Location {
        required int32 time = 1;
        required float latitude = 2;
        required float longitude = 3;
    }
}

You need to exclude the Request part.

Use a change node to move msg.payload.Request to msg.payload

Thanks !

I have changed the msg.payload.Request to msg.payload

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