401 Unauthorized Error On Some cPanel Logins

Operating System & Version
CentOS 7.9.2009
cPanel & WHM Version
94.0.1

Krydos

Well-Known Member
Jun 2, 2012
54
8
58
cPanel Access Level
Root Administrator
I just set up a new server. Installed the latest CentOS 7.9.2009. Installed cPanel 92.0.10. Created one reseller account, and created one normal account. Now on about 40% of logins to the normal cPanel account using port 2083 it immediately gives this error in a popup box in the top right:
Code:
The API request failed with the following error: 401 - Unauthorized. Your session may have expired or you logged out of the system.
Followed by a bunch of html and the suggestion to login again. Looking at the F12 console the first error listed is:
Code:
Uncaught SyntaxError: Unexpected token < in JSON at position 1
    at JSON.parse (<anonymous>)
    at parse_response (cjt2.cpanel.cmb.min.js?locale=en&locale_revision=1612482453:77)
    at Object.t [as dataFilter] (cjt2.cpanel.cmb.min.js?locale=en&locale_revision=1612482453:77)
    at Qb (frameworks.cmb.js:258)
    at A (frameworks.cmb.js:258)
    at XMLHttpRequest.<anonymous> (frameworks.cmb.js:258)
After that starts all the 401 errors on various resources like notification count, installed host, frameworks.cmb.js, Themes/list, list_accounts, get_usages, etc. Sometimes the css doesn't load, and the page is just a list of links. Sometimes the icons don't load. When the error occurs if you click any link or refresh the page it kicks you out to the login screen again.

I've tested it with Chrome 88.0.4324 with no installed extensions, and with Edge 88.0.705 with no installed extensions and the same 401 errors happen in both browsers. The other 60% of the time it logs in just fine with no popup errors, and no errors in the F12 console either. I can't find a way to replicate it 100% of the time. I have also tested it on Chromium 87.0.4280 and despite logging in over and over 100+ times it never gave the error. I have also tested it on Firefox 85 and it never gives the error either.

I have also upgraded to 94.0.1 in the hopes that it would fix the error, but the same thing happens on the current/edge version.

Any suggestions? Anyone else seeing this error?
 

Krydos

Well-Known Member
Jun 2, 2012
54
8
58
cPanel Access Level
Root Administrator
I should also mention that all of my other servers don't have this 401 unauthorized error on the older versions of cpanel that they're running. This is something new that has changed recently and affects 92, and 94. If anyone knows a way to install an older version of cpanel on a server I'd love to know about it.

I opened a ticket since I'm not getting any responses here. I'll update this thread with any information they give me.

Ticket #94241252
 

andrew.n

Well-Known Member
Jun 9, 2020
519
138
43
EU
cPanel Access Level
Root Administrator
It could be your network connection. Do you have enough free space and memory on the server? Just to make sure everything is up to date and properly installed can you run "/scripts/upcp --force" which will forcefully update your cPanel and the components to the most up to date one.
 

Krydos

Well-Known Member
Jun 2, 2012
54
8
58
cPanel Access Level
Root Administrator
Thanks for the reply. 78% of the memory is free. None of the partitions are above 18% full. I ran /scripts/upcp --force 3 times on cpanel/whm 92 and nothing changed, and then I upgraded to 94 and ran it again a few times and it still gives the 401 error occasionally. I contacted cpanel and they're trying to say that it's just me and they can't replicate the error. I hope they're right. I've got hundreds of users waiting to be moved to this server and it's going to be a mess if all of them are constantly getting 401 errors and not being able to log in on a brand new server that they've been waiting quite a while for. I'm going to have a few people other than me try logging in and see if they get the error. I'll report back.
 

andrew.n

Well-Known Member
Jun 9, 2020
519
138
43
EU
cPanel Access Level
Root Administrator
Please do as it sounds like your ISP connection or the network connection with the server though then cPanel support should have seen it as well.
 

Krydos

Well-Known Member
Jun 2, 2012
54
8
58
cPanel Access Level
Root Administrator
Alright, I've had 6 people other than me test this server plus at least 2 cpanel employees, and none of them can reproduce the 401 error using a whole bunch of different operating systems and browsers. Something strange is going on with my computer or my internet connection I guess. It's so weird that it only happens with this one server and it only started happening after I wiped it and reinstalled cpanel though. I can live with it if it's just me though. I was afraid of having a whole bunch of angry users asking me why they kept getting 401 errors. Thanks.