Balena push .catch() / 'ffi-mapi' error

I am trying to run my container using Balena push xyz.local and I am running into an error. I thought it was something wrong with my code but when running the example node ‘hello-world’ repo, it threw the same error:

[Debug] Sending target state: {“local”:{“name”:“blue-grass”,“config”:{“SUPERVISOR_DELTA_VERSION”:“3”,“HOST_CONFIG_disable_overscan”:“1”,“HOST_CONFIG_disable_splash”:“1”,“HOST_CONFIG_dtoverlay”:"“vc4-kms-v3d”",“HOST_CONFIG_dtparam”:"“audio=on”,“i2c_arm=on”,“spi=on”,“audio=on”",“HOST_CONFIG_enable_uart”:“1”,“HOST_CONFIG_gpu_mem”:“16”,“HOST_FIREWALL_MODE”:"",“SUPERVISOR_DELTA”:“1”,“SUPERVISOR_INSTANT_UPDATE_TRIGGER”:“true”,“SUPERVISOR_LOCAL_MODE”:“1”,“SUPERVISOR_POLL_INTERVAL”:“900000”,“SUPERVISOR_VPN_CONTROL”:“true”,“SUPERVISOR_CONNECTIVITY_CHECK”:“true”,“SUPERVISOR_LOG_CONTROL”:“true”,“SUPERVISOR_DELTA_REQUEST_TIMEOUT”:“30000”,“SUPERVISOR_DELTA_APPLY_TIMEOUT”:“0”,“SUPERVISOR_DELTA_RETRY_COUNT”:“30”,“SUPERVISOR_DELTA_RETRY_INTERVAL”:“10000”,“SUPERVISOR_OVERRIDE_LOCK”:“false”,“SUPERVISOR_PERSISTENT_LOGGING”:“false”,“HOST_DISCOVERABILITY”:“true”},“apps”:{“1”:{“name”:“localapp”,“commit”:“localrelease”,“releaseId”:“1”,“services”:{“1”:{“environment”:{},“labels”:{“io.resin.features.kernel-modules”:“1”,“io.resin.features.firmware”:“1”,“io.resin.features.dbus”:“1”,“io.resin.features.supervisor-api”:“1”,“io.resin.features.resin-api”:“1”},“privileged”:true,“tty”:true,“restart”:“always”,“network_mode”:“host”,“volumes”:[“resin-data:/data”],“imageId”:1,“serviceName”:“main”,“serviceId”:1,“image”:“local_image_main:latest”,“running”:true}},“volumes”:{“resin-data”:{}},“networks”:{}}}},“dependent”:{“apps”:,“devices”:}}
[Debug] Sending request to http://10.0.0.91:48484/v2/local/target-state
[Info] Streaming device logs…
[Debug] Sending request to http://10.0.0.91:48484/v2/local/device-info
[Live] Watching for file changes…
[Live] Waiting for device state to settle…
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
** Error: Cannot find module ‘ffi-napi’**
Require stack:
- /usr/local/lib/node_modules/balena-cli/node_modules/net-keepalive/lib/ffi-bindings.js
- /usr/local/lib/node_modules/balena-cli/node_modules/net-keepalive/lib/index.js
- /usr/local/lib/node_modules/balena-cli/node_modules/net-keepalive/index.js
- /usr/local/lib/node_modules/balena-cli/build/utils/device/api.js
- /usr/local/lib/node_modules/balena-cli/build/utils/device/deploy.js
- /usr/local/lib/node_modules/balena-cli/build/commands/push.js
- /usr/local/lib/node_modules/balena-cli/node_modules/@oclif/config/lib/plugin.js
- /usr/local/lib/node_modules/balena-cli/node_modules/@oclif/config/lib/config.js
- /usr/local/lib/node_modules/balena-cli/node_modules/@oclif/config/lib/index.js
- /usr/local/lib/node_modules/balena-cli/node_modules/@oclif/command/lib/command.js
- /usr/local/lib/node_modules/balena-cli/node_modules/@oclif/command/lib/index.js
- /usr/local/lib/node_modules/balena-cli/build/utils/oclif-utils.js
- /usr/local/lib/node_modules/balena-cli/build/preparser.js
- /usr/local/lib/node_modules/balena-cli/build/app.js
- /usr/local/lib/node_modules/balena-cli/bin/balena
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
at Function.resolveFilenameOptimized [as _resolveFilename] (/usr/local/lib/node_modules/balena-cli/node_modules/fast-boot2/index.js:57:33)
at Function.Module._load (internal/modules/cjs/loader.js:842:27)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object. (/usr/local/lib/node_modules/balena-cli/node_modules/net-keepalive/lib/ffi-bindings.js:4:9)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object. (/usr/local/lib/node_modules/balena-cli/node_modules/net-keepalive/lib/index.js:25:17)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
[Debug] Device state not settled, retrying in 1000ms
[Debug] Device state not settled, retrying in 1000ms

This is happening with GitHub - balena-io-examples/balena-node-hello-world: Run a simple express server with balena this repo as well as my container.

Thanks,

Hi there, this looks to be a problem with the CLI and not the project or your device. Have you done a successful deploy yet? If you haven’t then it might be that your balena-cli installation is no good, what method of installation did you use?

Also, if possible, can you try pushing to an app on balenaCloud instead of pushing to a local device? I want to try and narrow down the problem a bit.

Tmigone, I ended up upgrading my Balena-cli and it worked. Seems like 12.40 was the issue.

Thank you!

Glad to know you figured it out!