Error: gateway: could not handle packet: invalid character

Hi,all :I have setup all component of the loraserver.But when I powerup my test mote,I can see lora-gateway-bridge log with error msg : how can I handle this ?
time=“2018-10-07T17 :18:15+08:00” level=debug msg=“gateway: received udp packet from gateway” addr=" 101.232.203.70:44206" protocol_version=1 type=PushData
Oct 07 17:18:15 instance-eab9qu3v lora-gateway-bridge[3139]: time=“2018-10-07T17 :18:15+08:00” level=error msg=“gateway: could not handle packet: invalid character ‘\x00’ after top-level value” addr=“101.232.203.70:44206”

detail msg as follow:

lora-gateway-bridge[3139]: time=“2018-10-07T17 :18:10+08:00” level=debug msg=“gateway: received udp packet from gateway” addr=" 101.232.203.70:49658" protocol_version=1 type=PullData
Oct 07 17:18:10 instance-eab9qu3v lora-gateway-bridge[3139]: time=“2018-10-07T17 :18:10+08:00” level=debug msg=“gateway: sending udp packet to gateway” addr=“101 .232.203.70:49658” protocol_version=1 type=PullACK
Oct 07 17:18:13 instance-eab9qu3v lora-gateway-bridge[3139]: time=“2018-10-07T17 :18:13+08:00” level=debug msg=“gateway: received udp packet from gateway” addr=" 101.232.203.70:49658" protocol_version=1 type=PullData
Oct 07 17:18:13 instance-eab9qu3v lora-gateway-bridge[3139]: time=“2018-10-07T17 :18:13+08:00” level=debug msg=“gateway: sending udp packet to gateway” addr=“101 .232.203.70:49658” protocol_version=1 type=PullACK
Oct 07 17:18:15 instance-eab9qu3v lora-gateway-bridge[3139]: time=“2018-10-07T17 :18:15+08:00” level=debug msg=“gateway: received udp packet from gateway” addr=" 101.232.203.70:44206" protocol_version=1 type=PushData
Oct 07 17:18:15 instance-eab9qu3v lora-gateway-bridge[3139]: time=“2018-10-07T17 :18:15+08:00” level=error msg=“gateway: could not handle packet: invalid character ‘\x00’ after top-level value” addr=“101.232.203.70:44206” data_base64=Aa/WAA AADO+v0HhCeyJyeHBrIjpbeyJ0bXN0Ijo4MjA4MDA2NzUsInRpbWUiOiIyMDE4LTA5LTMwVDE0OjQ1Oj U5LjAwMzkwNloiLCJjaGFuIjoxLCJyZmNoIjowLCJmcmVxIjo0NzAuNTAwMDAwLCJzdGF0IjoxLCJtb2 R1IjoiTE9SQSIsImRhdHIiOiJTRjdCVzEyNSIsImNvZHIiOiI0LzUiLCJsc25yIjo3LjUsInJzc2kiOi 0zOCwic2l6ZSI6MjMsImRhdGEiOiJBSWgzWmxWRU15SVJpSGRtVlVRekltWThTM1l6Z1QwPSJ9XX0A

Which gateway and packet-forwarder version are you using?

Hi,brocaar,thank for your reply. my gateway is from nplink ,a supler from China ,and I do not know exactly what packet-forwarder version is .From the print msg,I can see “protocl_version = 1”,so the versoin should be early than 3.00. From the err msg we can confirm that upstream packge type PUSH_DATA identifier has been dectected and the following is gatewayID,my setting is 00000cefafd07842, in the err msg "invalid character ‘\0x00’ is refer to the MSB byte of the gatewayID ? Should the gatewayID be respective to a specific formmat in addition to MUST be 8 bytes in lenth? That is ,if I config the gatewayID of the gateway identical to the one I config in the lora-app-server with 8 bytes len ,that’s all and will be ok ?

           Thank you brocaar!

Hi,brocaar,I debug into the PUSH_DATA(packet ID is 0x00) packet data sent up to server by the gateway,I find that the PUSH_DATA packet abide by the rules of the protocol version 1 define by semteck .the PUSH_DATA packet data as follow:
01 15 44 00 00 00 0C EF AF D0 78 42 7B 22 73 74 61 74 22 3A 7B 22 74 69 6D 65 22 3A 22 32 30 31 38 2D 31 30 2D 30 38 54 31 31 3A 35 343A 31 38 2E 30 30 33 39 30 36 5A 22 2C 22 6C 61 74 69 22 3A 32 36 2E 30 38 30 30 30 2C 22 6C 6F 6E 67 22 3A 31 31 39 2E 32 38 30 30 30 2C 22 61 6C 74 69 22 3A 31 30 30 2C22 72 78 6E 62 22 3A 32 34 2C 22 72 78 6F 6B 22 3A 32 34 2C 22 72 77 66 77 22 3A32 34 2C 22 61 63 6B 72 22 3A 30 2E 30 2C 22 64 77 6E 62 22 3A 30 2C 2274 78 6E 62 22 3A 30 7D 7D 00

the first byte is protocol version byte ,next two bytes are ramdon token,and next byte:PUSH_DATA packet ID(0x00),the follow 8 bytes are gatewayID(00000cefafd07842),finally followed by the data payload of the packet. how come dose the lora-gateway-bridge complain the error msg “gateway:could not handle packet:invalid character ‘\0x00’ after top-level value”,Can you give me some hint? thank a lot!

You can reproduce the issue here: https://play.golang.org/p/8RrKU6Vn7Nn.

Following the specification, the the payload must end with } (0x7D), instead the last byte is 0x00. See also: https://github.com/Lora-net/packet_forwarder/blob/master/PROTOCOL.TXT#L103.

Best would be to contact the gateway vendor to see if there is a firmware update available to fix this issue / if they can issue a firmware update which fixes this issue. Feel free to refer to this post and the above code example :slight_smile: