I have tried to upgrade the balena-cli package to the latest update, but after the installation and the login I get this error trying to do the command:
balena devices
BalenaRequestError: Request error: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /v6/device</pre>
</body>
</html>
at Object.<anonymous> (/usr/local/lib/balena-cli/node_modules/balena-request/build/request.js:190:27)
at Generator.next (<anonymous>)
at fulfilled (/usr/local/lib/balena-cli/node_modules/tslib/tslib.js:111:62)
at process._tickCallback (internal/process/next_tick.js:68:7)
Am I forgetting something before being able to exploit balena-cli?
Just checking, are you running this against openBalena or balenaCloud? The latest API uses a version (v6) of the API models which the current openBalena API doesn’t have.
But still having some troubles while preloading an image.
balena preload balena-cloud-raspberrypi3-2.51.1+rev1-dev-v11.4.10.img
Building Docker preloader image. [========================] 100%
| Checking that the image is a writable file
| Finding a free tcp port and getting balena settings
| Checking if the image is an edison zip archive
/ Creating preloader container
/ Starting preloader container
| Reading image information
? **Select an application** r3-generic
? **Select a release** current
\ Fetching application 47
/ Cleaning up temporary files
BalenaRequestError: Request error: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /v6/application(47)</pre>
</body>
</html>
** EDIT**
at /usr/local/lib/balena-cli/node_modules/balena-request/build/request.js:189:17
From previous event:
at /usr/local/lib/balena-cli/node_modules/balena-request/build/request.js:181:62
From previous event:
at Object.exports.send (/usr/local/lib/balena-cli/node_modules/balena-request/build/request.js:180:8)
at /usr/local/lib/balena-cli/node_modules/balena-pine/es2018/index.js:20:22
From previous event:
at BalenaPine._request (/usr/local/lib/balena-cli/node_modules/balena-pine/es2018/index.js:12:34)
at BalenaPine.request (/usr/local/lib/balena-cli/node_modules/pinejs-client-core/es2018/index.js:952:29)
at BalenaPine.get (/usr/local/lib/balena-cli/node_modules/pinejs-client-core/es2018/index.js:701:21)
at /usr/local/lib/balena-cli/node_modules/balena-preload/node_modules/balena-sdk/es2018/models/application.js:245:26
From previous event:
at Object.get (/usr/local/lib/balena-cli/node_modules/balena-preload/node_modules/balena-sdk/es2018/models/application.js:239:32)
at Object.get (/usr/local/lib/balena-cli/node_modules/balena-preload/node_modules/balena-sdk/es2018/util/callbacks.js:19:27)
at Promise.try.then (/usr/local/lib/balena-cli/node_modules/balena-preload/lib/preload.js:498:47)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
at process.topLevelDomainCallback (domain.js:126:23)
From previous event:
at _runWithSpinner (/usr/local/lib/balena-cli/node_modules/balena-preload/lib/preload.js:497:8)
at Preloader._runWithSpinner (/usr/local/lib/balena-cli/node_modules/balena-preload/lib/preload.js:305:12)
at Preloader._fetchApplication (/usr/local/lib/balena-cli/node_modules/balena-preload/lib/preload.js:481:17)
at Preloader.setAppIdAndCommit (/usr/local/lib/balena-cli/node_modules/balena-preload/lib/preload.js:781:17)
at prepareAndPreload (/usr/local/lib/balena-cli/build/actions/preload.js:196:21)
EDIT
even if I am able to get the result of balena apps
@linus_h, unfortunately I believe the advice remains to downgrade the CLI to v12.2.2, as documented in openBalena’s Getting Started guide, as you have pointed out. CLI v12.2.2 offers full compatibility with openBalena (across all CLI commands), while newer versions will offer partial compatibility - some CLI commands will work, others won’t. The underlying reason is that openBalena is pending an update to work with balena SDK v14 or newer, which builds on balena API’s “/v6” HTTP endpoint.
@matteopeluso’s finding specifically regarding the balena preload command makes sense (that it works with CLI v12.9.4 but not with CLI v12.11.3), because CLI v12.9.5 updated the balena-preload dependency to a newer version that relies on balena SDK v14, which is currently incompatible with openBalena.
Relevant GitHub issues for tracking / subscribe for updates:
It includes support for the new API endpoints and newer versions of the balena SDK, and therefore the latest CLI releases. I have successfully tested openBalena v3 with CLI v12.25.6 (currently the latest version):
$ balena apps
ID APP NAME SLUG DEVICE TYPE ONLINE DEVICES DEVICE COUNT
1 myApp myapp raspberrypi3 1 2
$ balena devices
ID UUID DEVICE NAME DEVICE TYPE APPLICATION NAME STATUS IS ONLINE SUPERVISOR VERSION OS VERSION DASHBOARD URL
2 7d0cb2c bold-paper raspberrypi3 myApp Idle true 11.14.0 balenaOS 2.58.3+rev1 https://dashboard.vestamon.co.uk/devices/7d0cb2cb6e2e84ca7e75e554a9a8069b/summary
1 ae11d4f wild-glitter raspberrypi3 myApp false https://dashboard.vestamon.co.uk/devices/ae11d4f3b4db426a98606252180758e6/summary
$ balena device 7d0cb2c
== BOLD PAPER
ID: 2
DEVICE TYPE: raspberrypi3
STATUS: idle
IS ONLINE: true
IP ADDRESS: 192.168.1.36
APPLICATION NAME: myApp
...
For older versions of openBalena (older than v3.0.0), the recommendation remains to downgrade the CLI to v12.2.2.