I’m trying to view / set an env var with balena-cli for OpenBalena.
balena envs --application myApp
I get
BalenaRequestError: Request error: Internal Server Error
Additional information may be available in debug mode. Prefix the command
line with DEBUG=1, i.e.: DEBUG=1 balena ...
If you need help, don't hesitate in contacting our support forums at
https://forums.balena.io
For bug reports or feature requests, have a look at the GitHub issues or
create a new one at: https://github.com/balena-io/balena-cli/issues/
ajlennon@ajlennon-VirtualBox:~/git/does-rpi3-dash$ DEBUG=1 balena envs --application myApp
BalenaRequestError: Request error: Internal Server Error
at /usr/lib/node_modules/balena-cli/node_modules/balena-request/build/request.js:197:17
at tryCatcher (/usr/lib/node_modules/balena-cli/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/usr/lib/node_modules/balena-cli/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/usr/lib/node_modules/balena-cli/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/usr/lib/node_modules/balena-cli/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/usr/lib/node_modules/balena-cli/node_modules/bluebird/js/release/promise.js:694:18)
at _drainQueueStep (/usr/lib/node_modules/balena-cli/node_modules/bluebird/js/release/async.js:138:12)
at _drainQueue (/usr/lib/node_modules/balena-cli/node_modules/bluebird/js/release/async.js:131:9)
at Async._drainQueues (/usr/lib/node_modules/balena-cli/node_modules/bluebird/js/release/async.js:147:5)
at Immediate.Async.drainQueues (/usr/lib/node_modules/balena-cli/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:810:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)
If you need help, don't hesitate in contacting our support forums at
https://forums.balena.io
For bug reports or feature requests, have a look at the GitHub issues or
create a new one at: https://github.com/balena-io/balena-cli/issues/
Hello @ajlennon, see this thread for a solution using the API directly. TLDR; there is some dissonance in how env vars are handled between open source and cloud API v5 because the cloud API has some additional functionality that allows it to translate a request and match the model that didn’t make it in openBalena (yet). The next openBalena release will include a fix for this issue, but until then using the API directly is the workaround.
It looks to me like the API is still at this in the OpenBalena repo. How do I go about changing the API version I’m using (and will it break things I’m currently doing?)
As you have identified, the current openBalena release is using the v0.11.8 version. We pinned them like this so that we could more easily identify which versions people would have just from the openBalena version; in this case v1.0.1
To update the API manually, edit the versions file to use v0.17.0 and then run the following command: dc pull && dc stop && dc rm && dc up -d. This will stop and remove all your containers (but not their volumes) and recreate them. You shouldn’t lose any data, but still it would be best to do a backup/snapshot before doing this.