Closed dajtxx closed 3 years ago
I just noticed I could run the command with a numeric device id if I used all command line flags rather than redirecting from stdin as the examples show. This command runs ok:
/usr/local/bin/ttn-lw-migrate device 5228129 --dry-run --source ttnv2 --ttnv2.app-id axioma_flow --ttnv2.app-access-key <key here> --ttnv2.frequency-plan-id AS_920_923_TTN_AU
The issue here is not the numeric names but the length of Identifier. IDs in v3 are required to be at least 3 characters in length. We will update the API to return a clearer error message but your two digit device IDs are not valid in v3.
Now v2 is read only I cannot change the key on the v2 device to prevent it joining. So even though I've created the device in v3 using the euis etc, I can't quite replicate whatever the migration tool does.
I think a better approach would have been to have the migration tool accept the name, emit a warning, and have the v3 cli tool and API reject the device definition if it contains an invalid name.
I guess the problem will be gone in a few months, but I have more 2 digit dev ids to migrate (some today) so have to jump through the hoops to do it.
https://github.com/TheThingsNetwork/lorawan-stack-migrate/pull/34 This PR adds support to add a prefix to your device IDs before exporting them. That should fix the issue that you encountered here.
LOL, we probably migrated the last of the 2 digit numeric id devices last week.
Anyway, good you found a way to work a fix in with something else.
Summary
We have a couple of devices with purely numeric names - 19 and 26.
The device name checking regexp doesn't allow for these: