I am hoping to use the Balena Python SDK to pre-register my devices so that I can set critical environment variables at the same time the SD card is flashed.
However, when my python script executes balena.models.device.register(<my_application_name>, <32_character_UUID>)
I receive an internal server error.
Here is my balena.cfg file (I am running openBalena 2, not 3 yet):
We actually meant the logs printed by the open-balena-api container that’s running on your server.
Let me point you to the template part of the respective docker-compose service:
Once you get a terminal session to the open-balena server, you should be able to do a docker ps to grab the API container name and just use journalctl -f -n 100 -u <CONTAINER_NAME> to start seeing the emitted logs.
I have attached my logs from the docker ps (docker-ps.log) and journalctl -f -n 100 -u openbalena_api_1 (journalctl-api.log). Since the journalctl didn’t show any logs, I also tried without the -u flag and have attached that output (journalctl.log)
Any ideas as to why the journalctl command you gave didn’t show anything? Do I need to log in as a particular user? I did make sure to test out the code which produces the error while the journalctl was running.
I got it working! The example in the documentation here indicates that you should pass in the application name, however after poking around the API code I tried passing in the application ID instead, and everything worked!
Are there any plans to consolidate the use of the app id vs the application name throughout the API? I get confused switching between the two, in my mind it would make sense to just pick one way to reference an app via the SDK.
I completely agree that there should be consistency, and in fact we already have an issue open on the Python SDK to bring it inline with the node.js SDK and support id, device UUID and the application name: