Error when regenerating device credentials
- Dominant language
- JavaScript
- Stars
- 400
- Forks
- 89
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 149
Description
### Current Behavior
Capturing this error Steve hit once when attempting to regenerate device credentials. Tried a second time and it worked. Looks like a timing issue in the clear-up of the old BrokerClient object for the device before generating the new one
```
Error
at async BrokerClient.create (/usr/src/forge/app/node_modules/sequelize/lib/model.js:1362:12)
at async Object.createClientForDevice (/usr/src/forge/app/node_modules/@flowfuse/flowfuse/forge/db/controllers/BrokerClient.js:100:13)
at async model.refreshAuthTokens (/usr/src/forge/app/node_modules/@flowfuse/flowfuse/forge/db/models/Device.js:181:36)
at async Object. (/usr/src/forge/app/node_modules/@flowfuse/flowfuse/forge/routes/api/device.js:645:29)
```
```
"ValidationErrorItem","message":"username must be unique","stack":"","path":"username","value":"device:[ABC]:[XYZ]"
```
### Expected Behavior
_No response_
### Steps To Reproduce
_No response_
### Environment
- FlowFuse version:
- Node.js version:
- npm version:
- Platform/OS:
- Browser:
### Have you provided an initial effort estimate for this issue?
I have provided an initial effort estimate
Contributor guide
Assessment
This issue has not been assessed yet.