aws-connected-device-framework icon indicating copy to clipboard operation
aws-connected-device-framework copied to clipboard

provisioning: cannot delete thing if still attached to a principal

Open aaronatbissell opened this issue 3 years ago • 3 comments

Aws Connected Device Framework Affected Module(s):

provisioning

I'm submitting a ...

  • [x] bug report
  • [ ] feature request

Description:

There are times (not very reproducible) where we call deleteThing from the provisioning service, which detaches that thing from it's principals (certs, policies, etc), and then deletes the thing from IOT core, and the service returns a 500 error and reports:

InvalidRequestException: Cannot delete. Thing <thingName> is still attached to one or more principals

Current behavior:

500 Error is thrown

Expected behavior:

Provisioning service catches this error and attempts to re-detach principals if the first attempt didn't work for some reason.

Steps to reproduce:

Use the provisioning service to fully provision a device, then delete it using the provisioning service. Do this over-and-over and you should eventually see some errors.

Additional Information: I think this is a problem with the AWS javascript SDK where it returns from the detachThingPrincipal function prior to it fully detatching the thing principal.

Screen Shot 2022-06-16 at 11 40 17 AM

aaronatbissell avatar Jun 16 '22 15:06 aaronatbissell

Thanks for reporting this @aaronatbissell, looks like this is something that need to be fixed from the IoT Device Management itself rather than fixing it on CDF.

williamsia avatar Jun 27 '22 11:06 williamsia

Probably true - but I wouldn't think you'd want the provisioning service returning a 500, right? How would we get this on the backlog of the IoT Device Management Team?

aaronatbissell avatar Jun 27 '22 11:06 aaronatbissell

Hi @aaronatbissell, will raise it on your behalf.

williamsia avatar Jun 29 '22 05:06 williamsia