Error: sql: Scan error on column ...: unsupported Scan, storing driver.Value type

Hi, guys. I managed to merge my custom lora-app-server and loraserver sources with the latest upstream versions. It’s almost entirely working, but there’s one issue that I haven’t been able to resolve yet. After creating a device profile, If I try to open the update profile form, I get an error from loraserver:

Error rpc error: code = Unknown desc = sql: Scan error on column index 5: unsupported Scan, storing driver.Value type []uint8 into type *backend.RatePolicy (code: 2)

Later I noticed that when receiving a join request from a node, the packet processing failed with the same issue:

processing rx packet error: get service-profile error: select error: sql: Scan error on column index 5: unsupported Scan, storing driver.Value type []uint8 into type *backend.RatePolicy

So there’s a problem when getting a service profile from the DB. I checked and loraserver’s ServiceProfile has a backend.ServiceProfile field defined in lorawan package. So I pulled the latest lorawan version (I was a couple of commits behind), rebuilt loraserver and lora-app-server, and created a new service profile, but I still got the error.

Any ideas?

Here’s an example of my service profiles from loraserver’s DB:

created_at           |          updated_at           |          service_profile_id          | ul_rate | ul_bucket_size | ul_rate_policy | dl_rate | dl_bucket_size | dl_rate_policy | add_gw_metadata | dev_status_req_freq | report_dev_status_battery | report_dev_status_margin | dr_min | dr_max | channel_mask | pr_allowed | hr_allowed | ra_allowed | nwk_geo_loc | target_per | min_gw_diversity 
-------------------------------+-------------------------------+--------------------------------------+---------+----------------+----------------+---------+----------------+----------------+-----------------+---------------------+---------------------------+--------------------------+--------+--------+--------------+------------+------------+------------+-------------+------------+------------------
 2017-11-13 15:15:28.90676-03  | 2017-11-13 15:15:28.90676-03  | ad11f53a-fb3f-4912-91f8-577fea331056 |       0 |              0 | Drop           |       0 |              0 | Drop           | t               |                   0 | f                         | f                        |      0 |      0 | \x           | f          | f          | f          | f           |          0 |                0

Could you try compiling using the latest Go version?

That seemed to do the trick: now I can get and update a service profile, and when simulating an ABP node through a script it works fine and logs all the frames. I’m yet to check if an OTAA node through a proper gateway works, but it should too.

Thanks a lot, Orne!