chirpstack / chirpstack-v3-to-v4

Utility to migate ChirpStack v3 data into ChirpStack v4.
MIT License
8 stars 6 forks source link

Incorrect decodeUplink and encodeDownlink #4

Closed mmrein closed 1 year ago

mmrein commented 1 year ago

I guess https://github.com/chirpstack/chirpstack/issues/39 also applies for migration tool.

mmrein commented 1 year ago

Could possibly be improved in following way because in Chirpstack v3 there was error logged in the Events tab when decoder failed to decode data in case the data: null was received (which was quite expected).

In Chirpstack v4 the Events tab seems "frozen" upon receiving such message and no more data is logged in the Events tab after that (while LoRaWAN frames continues to log the up/down packets correctly) and ERROR chirpstack::api::internal: Reading event-log returned error: Cannot serialize NaN as google.protobuf.Value.number_value is being continuously logged in the journal (once per second it seems).

// v3 to v4 compatibility wrapper
function decodeUplink(input) {
    // Check if bytes array is not empty:
    if ( input.bytes.length > 0 ) { 
        return { 
            data: Decode(input.fPort, input.bytes, input.variables)
        };   
    }
}
brocaar commented 1 year ago

Thanks!

With regards the error:

ERROR chirpstack::api::internal: Reading event-log returned error: Cannot serialize NaN as google.protobuf.Value.number_value

I think that is better fixed in the ChirpStack code itself. I'll look into this.

brocaar commented 1 year ago

@mmrein the above commit to ChirpStack fixes this issue properly.

mmrein commented 1 year ago

Thanks for letting me know. Will test eventually when I regain access to server (network restructure).