TheThingsNetwork / lorawan-stack

The Things Stack, an Open Source LoRaWAN Network Server
https://www.thethingsindustries.com/stack/
Apache License 2.0
937 stars 302 forks source link

Registries require device identifiers unnecessarily (http bridge) #305

Open kschiffer opened 5 years ago

kschiffer commented 5 years ago

Summary: The device registries will prompt an error on PUT operations when the payload does not at least contain a join_eui or dev_eui, even though the route contains the device id. Steps to Reproduce: Consider the following request:

PUT /api/v3/as/applications/second-app-1549982428036/devices/dev-1552932414447 HTTP/1.1
{
    "end_device": { 
      "session": {
        "last_a_f_cnt_down": 10
      }
    },
    "field_mask": { "paths": ["session.last_a_f_cnt_down"] }
}

What do you see now?

{
    "code": 3,
    "message": "error:pkg/applicationserver/redis:invalid_identifiers (invalid identifiers)",
    "details": [
        {
            "@type": "type.googleapis.com/ttn.lorawan.v3.ErrorDetails",
            "namespace": "pkg/applicationserver/redis",
            "name": "invalid_identifiers",
            "message_format": "invalid identifiers",
            "attributes": {},
            "correlation_id": "4eccbd042ddc474c91f9c9d306b92e23"
        }
    ]
}

What do you want to see instead? A successful update operation.

How do you propose to implement this? As far as I can tell, the presence of identifiers in the payload should not be necessary when the route already provides identifiers.

Environment: Browser

What can you do yourself and what do you need help with? Help!

johanstokking commented 5 years ago

Reassigning; introduced in https://github.com/TheThingsNetwork/lorawan-stack/commit/6d5d853a15a06cf76943df61a2b94a0b60bb1a1f

I don't think we need to have the EUIs as part of the set if the device already exists.