I’m trying to use the node sdk to restart a service on a device.
balena.models.device.restartService(uuid, imageId)
I’m getting the image id via the current_services
array returned as part of
balena.models.device.getWithServiceDetails(uuid)
in the shape of:
{ "<service-name>": [{ ... "image_id": 999999, ... }] }
However when I run the restartService method above the response is:
ERROR : (node:90) UnhandledPromiseRejectionWarning: BalenaRequestError: Request error: Service not found, a container must exist for this endpoint to work
I can restart the service by using the supervisor api but only if I send the serviceName
not imageId
which results in the same error. Is there a different way to get the imageId or a way to get a different imageId that works?
Thanks for the help.