Datacake - json: unsupported value: NaN

Hi there,

I am trying to get the RAK10701 field tester to work.
I am following the instructions in RAK10701-L Field Tester for LoRaWAN Quick Start Guide (Chirpstack + Datacake)

The field tester is sending the payload to Chirpstack and it is forwarded to Datacake.
But the Decoder does not work:

json: unsupported value: NaN

The received payload looks like this:

{
   "deduplicationId":"27128c46-7445-44ac-b441-ff023bf810f4",
   "time":"2025-04-07T13:39:20.792434+00:00",
   "deviceInfo":{
      "tenantId":"XXX",
      "tenantName":"ChirpStack",
      "applicationId":"XXX",
      "applicationName":"Fieldtester",
      "deviceProfileId":"XXX",
      "deviceProfileName":"LoRaWAN-Field-Tester",
      "deviceName":"Fieldtester1",
      "devEui":"XXX",
      "deviceClassEnabled":"CLASS_A",
      "tags":{
         
      }
   },
   "devAddr":"XXX",
   "adr":false,
   "dr":0,
   "fCnt":68,
   "fPort":1,
   "confirmed":true,
   "data":"JHa0BVeSBCILCQ==",
   "object":{
      "altitude":58.0,
      "latitude":XXX,
      "longitude":XXX,
      "accuracy":1.05,
      "hdop":1.1,
      "sats":9.0
   },
   "rxInfo":[
      {
         "gatewayId":"XXX",
         "uplinkId":40904,
         "gwTime":"2025-04-07T13:39:20.792434+00:00",
         "nsTime":"2025-04-07T13:39:20.799504215+00:00",
         "rssi":-54,
         "snr":7.8,
         "channel":5,
         "location":{
            
         },
         "context":"PKy8YA==",
         "crcStatus":"CRC_OK"
      }
   ],
   "txInfo":{
      "frequency":867500000,
      "modulation":{
         "lora":{
            "bandwidth":125000,
            "spreadingFactor":12,
            "codeRate":"CR_4_5"
         }
      }
   },
   "regionConfigId":"eu868"
}

I am using the Github Script “RAK10701-FieldTester.js” as Decoder in Datacake, is that correct?

Greetings
Sebastian

Welcome to the forum @borsti

The decoder you use is the right one.

Your gateway is not reporting a location:
image

Make sure all your gateways report a location (fake or from GNSS/GPS module).
If one of the gateways does not report a location an error like you see can happen.

I extended the decoder to catch this issue, but it is not on Github. However, as long as your gateway is not reporting its location, you will not get min/max distance between the tester and the gateway.

Try the attached decoder please.
from-datacake.zip (1.9 KB)

Hi @beegee

thank you for pointing me in the right direction. I will try to fix the missing location information.

In the meantime your decoder works great.

Thank you!!

Greetings
Sebastian