# balena login fails after new server setup, getting BalenaRequestError

**URL:** <https://forums.balena.io/t/balena-login-fails-after-new-server-setup-getting-balenarequesterror/369161>\
**Category:** openBalena\
**Tags:** docker, balena-cli\
**Created:** [October 18, 2023, 6:39pm UTC](https://forums.balena.io/t/balena-login-fails-after-new-server-setup-getting-balenarequesterror/369161 "2023-10-18T18:39:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![khoran](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@khoran](https://forums.balena.io/u/khoran)\
**Post date:** [October 18, 2023, 6:39pm UTC](https://forums.balena.io/t/balena-login-fails-after-new-server-setup-getting-balenarequesterror/369161/1 "2023-10-18T18:39:53Z")

</div>

When I try to do ‘balena login’ I get:

```auto
$ balena login --credentials --email xx@xxxx.org --password xxxxx --debug (10-18 14:10)
[debug] new argv=[/home/khoran/programs/balena-cli/balena,/snapshot/balena-cli/bin/balena,login,--credentials,--email,xx@xxxx.org,--password,xxxx] length=8
[debug] Deprecation check: Cache miss for the balena CLI next major version release date.
[debug] Will query https://registry.npmjs.org/balena-cli/18.0.0
 _ _
| | ____ _ | | _______ __ _
| '_ \ / _` || | / __ \| '_ \ / _` |
| |_) | (_) || || ___/| | | || (_) |
|_. __/ \__ ,_||_| \ ____/|_| |_| \__ ,_|

Logging in to ob.galcom.org
[debug] Event tracking error: Timeout awaiting 'response' for 0ms
BalenaRequestError: Request error: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /actor/v1/whoami</pre>
</body>
</html>

BalenaRequestError: Request error: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /actor/v1/whoami</pre>
</body>
</html>

    at Object.<anonymous> (/snapshot/balena-cli/node_modules/balena-request/build/request.js:193:27)
    at Generator.next (<anonymous>)
    at fulfilled (/snapshot/balena-cli/node_modules/tslib/tslib.js)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

For further help or support, visit:
https://www.balena.io/docs/reference/balena-cli/#support-faq-and-troubleshooting

```

I have followed the openbalena getting started guide. I ran the quickstart and generated the certificates OK. I’ve set the NODE\_EXTRA\_CA\_CERTS environment variable.

Running

```auto
curl -k https://api.ob.galcom.org/ping 

```

results in “OK”.

I logged into the api container and ran tcpdump -A so I could see the HTTP traffic. It seem that the “/login\_” endpoint succeeds and returns a token. But then every other url fails:

```auto
POST /login_ HTTP/1.1                                                                                                                                                                                                                                                               
X-Balena-Client: balena-sdk/18.0.2                                                                                                                                                                                                                                                               
Content-Type: application/json                                                                                                                                                                                                                                                                   
Accept-Encoding: compress, gzip                                                                                                                                                                                                                                                                  
Accept: */*                                                                                                                                                                                                                                                                                      
Content-Length: 56                                                                                                                                                                                                                                                                               
User-Agent: node-fetch/1.0 (+https://github.com/bitinn/node-fetch)                                                                                                                                                                                                                               
Connection: close                                                                                                                                                                                                                                                                                
Host: api.ob.galcom.org                                                                                                                                                                                                                                                                          
X-Forwarded-Proto: https                                                                                                                                                                                                                                                                         
X-Forwarded-For: 192.168.0.1                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                                 
{"username":"xx@xxxx.org","password":"xxx"}     
HTTP/1.1 200 OK
...

GET /actor/v1/whoami HTTP/1.1
Authorization: Bearer XXXXXX<confirmed this is token returned by login_>
X-Balena-Client: balena-sdk/18.0.2
Accept-Encoding: compress, gzip
Accept: */*
User-Agent: node-fetch/1.0 (+https://github.com/bitinn/node-fetch)
Connection: close
Host: api.ob.galcom.org
X-Forwarded-Proto: https
X-Forwarded-For: 192.168.0.1

HTTP/1.1 404 Not Found
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, PUT, POST, PATCH, DELETE, OPTIONS, HEAD
Access-Control-Allow-Headers: Content-Type, Authorization, Application-Record-Count, MaxDataServiceVersion, X-Requested-With, X-Balena-Client
Access-Control-Allow-Credentials: true
Access-Control-Max-Age: 86400
Content-Security-Policy: default-src 'none'
Content-Type: text/html; charset=utf-8
Content-Length: 154
Vary: Accept-Encoding
Date: Wed, 18 Oct 2023 18:30:22 GMT
Connection: close

```

Been fighting with this one for a whole day. The API container never logs anything beyond the initial message that systemd started. PRODUCTION\_MODE is false.

Any ideas? Thanks.

---

<div class="post-metadata">

**Author:** ![khoran](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@khoran](https://forums.balena.io/u/khoran)\
**Post date:** [October 18, 2023, 6:51pm UTC](https://forums.balena.io/t/balena-login-fails-after-new-server-setup-getting-balenarequesterror/369161/2 "2023-10-18T18:51:17Z")

</div>

Just found this article after posting: [Login not working with balena-cli](https://forums.balena.io/t/login-not-working-with-balena-cli/369153).

Downgrading balena-cli to 16.7.6 also fixed my problem.
