Restart application is not working with openBalena

Using balena-cli : “balena app restart appName” / “balena app restart uuid”
or node-sdk :
balena.models.device.restartApplication(uuid)

I get this error :

> BalenaRequestError: Request error: 
> <!DOCTYPE html>
> <html lang="en">
> <head>
> <meta charset="utf-8">
> <title>Error</title>
> </head>
> <body>
> <pre>Cannot POST /application/9/restart</pre>
> </body>
> </html>
> 
>     at /usr/local/lib/node_modules/balena-cli/node_modules/balena-request/build/request.js:197:17
>     at tryCatcher (/usr/local/lib/node_modules/balena-cli/node_modules/bluebird/js/release/util.js:16:23)
>     at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/balena-cli/node_modules/bluebird/js/release/promise.js:517:31)
>     at Promise._settlePromise (/usr/local/lib/node_modules/balena-cli/node_modules/bluebird/js/release/promise.js:574:18)
>     at Promise._settlePromise0 (/usr/local/lib/node_modules/balena-cli/node_modules/bluebird/js/release/promise.js:619:10)
>     at Promise._settlePromises (/usr/local/lib/node_modules/balena-cli/node_modules/bluebird/js/release/promise.js:699:18)
>     at _drainQueueStep (/usr/local/lib/node_modules/balena-cli/node_modules/bluebird/js/release/async.js:138:12)
>     at _drainQueue (/usr/local/lib/node_modules/balena-cli/node_modules/bluebird/js/release/async.js:131:9)
>     at Async._drainQueues (/usr/local/lib/node_modules/balena-cli/node_modules/bluebird/js/release/async.js:147:5)
>     at Immediate.Async.drainQueues (/usr/local/lib/node_modules/balena-cli/node_modules/bluebird/js/release/async.js:17:14)
>     at runCallback (timers.js:794:20)
>     at tryOnImmediate (timers.js:752:5)
>     at processImmediate [as _immediateCallback] (timers.js:729:5)

Hey, @gatienb I’m not sure why this isn’t working. Are you able to SSH into the device using balena ssh ?

Can you please run ./scripts/compose exec api journalctl -fn100 on the openBalena server and paste the output here?

Hi,

I have taken a look at this, and from the logs you pasted above this seems to be showing the that SDK is using a route which is specific to the balenaCloud version of the API and is not part of the openBalena base version. I am speaking to collegues about what we should do about this, but in the meantime you should be able to use the Supervisor API proxy (docs here) to restart your services on the device.

Hey,

Thanks for your answers
@CameronDiver : yes I can ssh into the device with “balena local ssh”
@dfunckt & @richbayliss : I will try next week and come back to you

Hi,

Sorry for the delay, it works fine with the Supervisor API proxy.
Thanks for your help