Connection fails with "SELF_SIGNED_CERT_IN_CHAIN" (balena-cli)

Hello friends,

I ran into an issue with my local setup. I’m trying to connect to openBalena that is running on AWS. I’ve followed instructions and did all steps necessary to run containers on a server.

When I try to login to my balena.iot with generated credentials I see the error bellow.

SELF_SIGNED_CERT_IN_CHAIN: request to https://api.balena.iot/login_ failed, reason: self signed certificate in certificate chain

FetchError: request to https://api.balena.iot/login_ failed, reason: self signed certificate in certificate chain
at ClientRequest. (/snapshot/versioned-source/node_modules/node-fetch/index.js:133:11)
at ClientRequest.emit (events.js:203:15)
at ClientRequest.EventEmitter.emit (domain.js:448:20)
at TLSSocket.socketErrorListener (_http_client.js:392:9)
at TLSSocket.emit (events.js:198:13)
at TLSSocket.EventEmitter.emit (domain.js:448:20)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
From previous event:
at new Fetch (/snapshot/versioned-source/node_modules/node-fetch/index.js:49:9)
at Fetch (/snapshot/versioned-source/node_modules/node-fetch/index.js:37:10)
at module.exports.fetch.Promise (/snapshot/versioned-source/node_modules/fetch-ponyfill/fetch-node.js:15:12)
at requestAsync (/snapshot/versioned-source/node_modules/balena-request/build/utils.js:327:7)
From previous event:
at requestAsync (/snapshot/versioned-source/node_modules/balena-request/build/utils.js:346:22)
at exports.getRequestAsync (/snapshot/versioned-source/node_modules/balena-request/build/utils.js:396:12)
at /snapshot/versioned-source/node_modules/balena-request/build/request.js:176:14
From previous event:
at Object.module.exports.exports.send (/snapshot/versioned-source/node_modules/balena-request/build/request.js:175:89)
at authenticate (/snapshot/versioned-source/node_modules/balena-sdk/build/auth.js:150:14)
at login (/snapshot/versioned-source/node_modules/balena-sdk/build/auth.js:188:16)
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 Object.authenticate (/snapshot/versioned-source/build/utils/patterns.js:27:10)
at doLogin (/snapshot/versioned-source/build/actions/auth.js:86:33)
at doLogin (/snapshot/versioned-source/build/actions/auth.js:102:20)

For help, visit our support forums: https://forums.balena.io
For bug reports or feature requests, see: Issues · balena-io/balena-cli · GitHub

Have any of you seen this before. Please help :slight_smile:

Hi @vladslav , welcome to the community! The first thing I would like to check is that you have completed the "install self signed cert " ( https://www.balena.io/open/docs/getting-started#Install-self-signed-certificates ) section of the getting started. Specifically making sure you have set export NODE_EXTRA_CA_CERTS='/path/to/ca.crt' correctly?

I did re-setup one more time from the start. And it worked with NODE_EXTRA_CA_CERTS var. Thanks!