# Problems with Decommission device \[ UI / API \]

**URL:** <https://hub.mender.io/t/problems-with-decommission-device-ui-api/6773>\
**Category:** General Discussions\
**Tags:** ui, api, decommission\
**Created:** [April 30, 2024, 3:39am UTC](https://hub.mender.io/t/problems-with-decommission-device-ui-api/6773 "2024-04-30T03:39:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![caleb](https://avatars.discourse-cdn.com/v4/letter/c/58956e/32.png) [@caleb](https://hub.mender.io/u/caleb)\
**Post date:** [April 30, 2024, 3:39am UTC](https://hub.mender.io/t/problems-with-decommission-device-ui-api/6773/1 "2024-04-30T03:39:08Z")

</div>

Hello community, I encounter strange behavior when I try to decommission a device, create a pre-authorization of a device and interactions between them.

I created a process where I make a call of the Mender API for a pre-authorization of a device. To know if the device is already processed, I check the MAC address, if I find the MAC I decommission the device and pre-authorize a new device, if I do not find the device, I pre-authorize a new device.

##### Docs api:

- List devices: [Mender API docs](https://docs.mender.io/api/?javascript#management-api-device-authentication-list-devices)
- Decommission device: [Mender API docs](https://docs.mender.io/api/?javascript#management-api-device-authentication-decommission-device)
- Pre-authorization: [Mender API docs](https://docs.mender.io/api/?javascript#management-api-device-authentication-preauthorize)

### This leads to strange behaviors:

1. **First strange behavior:**  
I try to decommission a device from the API, once I do this, something it did not get decommission and I cannot decommission them from the API nor the UI.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/mender/original/2X/f/f5068ca4111408f70497be1f0bffa987dce5c386.png)

1. **Second strange behavior:**  
I try to decommission a device but it lose the authorization (post pre-authorization and post acceptance). But it keeps in the UI of the devices. Sometime it decommission after 30 minutes, but there are some that do not. I cannot decommission those devices.

 ![imgonline-com-ua-twotoone-jUwlgzTyUkABGXg](https://canada1.discourse-cdn.com/flex036/uploads/mender/original/2X/e/ed765d57d603222a243a766fb053d29fc8e3da49.jpeg)

1. **Third strange behavior:**  
I try to decommission a device and creates a **no-auth / accepted** state at the same time.

![mender_noauth_accepted](https://canada1.discourse-cdn.com/flex036/uploads/mender/original/2X/e/e6f097d1cdf9cc941eb15c876b6b42e5e8c2b94c.gif)

It keeps flicking in this state and I also cannot deleted (this more often decommission after 30 minutes or so).

Normally this issues happen when I try to do decommission and pre-authorization one after the other.  
Today I find the **First strange behavior** without this, just pre-authorization.

I want to know if after decommission a device from the API I need to wait certain time or after any decommission if I need to wait certain time before I make a new pre-authorization.  
Does anyone find something similar?

#### Version:

{“Mender-Client”:“4.0.2”,“Mender-Artifact”:“3.11.2”,“Meta-Mender”:“”,“Deployments”:“”,“Deviceauth”:“”,“Inventory”:“”,“GUI”:“saas-v2024.04.11”,“backend”:“saas-v2024.04.11”}  
**It is** hosted by Mender. **It is not** self-hosted.

---

<div class="post-metadata">

**Author:** ![robgio](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/robgio/32/1760_2.png) [@robgio](https://hub.mender.io/u/robgio)\
**Post date:** [April 30, 2024, 7:57am UTC](https://hub.mender.io/t/problems-with-decommission-device-ui-api/6773/2 "2024-04-30T07:57:48Z")

</div>

Hi @caleb ,  
if you’re using Hosted Mender, we’ve seen some issues regarding NATS messages this night, but the problem should be solved now. Can you please check?

---

<div class="post-metadata">

**Author:** ![caleb](https://avatars.discourse-cdn.com/v4/letter/c/58956e/32.png) [@caleb](https://hub.mender.io/u/caleb)\
**Post date:** [April 30, 2024, 10:22pm UTC](https://hub.mender.io/t/problems-with-decommission-device-ui-api/6773/3 "2024-04-30T22:22:21Z")

</div>

Thanks @robgio for your quick response.

Today I decommissioned some devices and made some pre-authorizations without problems. But on Thursday I’ll test the complete flow and have a better answer.

Thanks again for your time answering my question.
