Can't Add Device to nrfCloud via REST API

Recently I had been having trouble with one of our test devices (shadow was corrupted) on nrfCloud so I decided to delete it and then re-provision and re-add it to nrfCloud to start fresh (something we have done several times before). 

We have a a python script that automates this process by doing the following steps:

  1. Loads modem firmware via J-link
  2. loads at_client via J-link
  3. gets the IMEI via UART
  4. generates the certificates by calling -> curl -X POST api.nrfcloud.com/.../{' + IMEI + '}/certificates -d "123456" -H "Authorization: Bearer XXXXXXXXXXX" -H "Content-Type: text/plain" -o' + IMEI + '.json'
  5. Loads the certs using the UART and at_client
  6. Generates a certs.csv with all the provisioned devices (the scrip can do multiple at once before uploading)
  7. Uploades to nrfcloud using -> curl --location --request POST api.nrfcloud.com/.../devices --header "Authorization: Bearer XXXXXXXXX" --header "Content-Type: text/csv" --data-binary "@certs.csv

After running this script the bulk operation failed. with the following error: 

{"errors":"A total of 1 error(s) occurred while processing the CSV [failed row indices (1-based)]: {\"Thing m8-351358811339107 already exists in account with different attributes\":[1]}."}

This seems to indicate that the device already exists, but there is no record of it in GUI interface and when call FetchDevice via the API I get:
{
    "message": "Cannot verify device ownership (missing tenantId attribute)",
    "code": 40410
}
We had previously see this same scrip work as recently as 2024-01-24T21:31:58.073Z(UTC)
Any help would be great, we currently have not way to use this development device in question until this is resolved.
Thanks
Parents
  • Hello Eric,

    That device is shown as provisioned but not associated with any team yet. This normally occurs if you flash JITP certs you obtained from /devices/{' + IMEI + '}/certificates  onto the device, and then turn on the device, before calling your POST api.nrfcloud.com/.../devices. The device connects to nRF Cloud via MQTT and waits to be associated to a team. Could you have done this?

    I have deleted the device from our database. Please try your process again.

  • Thanks for deleting the device on your end, that worked! I have a few additional questions:

    1. What would cause nrfCloud to think that we want to use JITP as apposed to just creating the device on nrfCloud? I would like to understand this so we can track down why it happened to prevent it from happening again. Because we do not currently have JITP enabled in our firmware. 

    2. Does Nordic typically recommend JITP over the process of just adding the device to the cloud at the time of loading the certs during manufacturing?

    Thanks again,

    Eric

Reply
  • Thanks for deleting the device on your end, that worked! I have a few additional questions:

    1. What would cause nrfCloud to think that we want to use JITP as apposed to just creating the device on nrfCloud? I would like to understand this so we can track down why it happened to prevent it from happening again. Because we do not currently have JITP enabled in our firmware. 

    2. Does Nordic typically recommend JITP over the process of just adding the device to the cloud at the time of loading the certs during manufacturing?

    Thanks again,

    Eric

Children
Related