Symptoms
The following error occurs while accessing Plesk from WHMCS via API as customer with login johndoe or changing the password:
Error code: 1013. Error message: Customer with external id ‘whmcs_plesk_XX‘ is not found in panel.
Cause
external_id
entry is missing in psa.clients
MySQL table. In case it happens during the migration, check this article: Cannot login to Plesk via WHMCS after migration: Customer with external id ‘whmcs_plesk_XX’ is not found in panel
Resolution
Note: To view all orphaned client accounts (which has no or invalid external_id),the following MySQL query can be used:
mysql> select id,cname,pname,login from clients where parent_id = 1 and (external_id = NULL or external_id = ‘0’ or external_id = ») and clients.type <> ‘reseller’;
Note: if the issue appears on a WHMCS integrated with Plesk Multi Server, this database update should be done on the management node side.
- Log into the server via SSH.
- Create a backup of psa database:# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump psa -uadmin > psa.current.sql
- Access Plesk database from command line:# plesk db
- Update the following value:mysql> update clients set external_id=’whmcs_plesk_XX‘ where login=’johndoe‘;where whmcs_plesk_XX – should be replaced with ID from the error
johndoe – should be replaced with login of the customer affected by the issue.
# plesk db # update clients set external_id='a148d5aa-13cb-4d7c-9449-e938313a645c' where login='loginname';
Additional Information
It is possible to apply the fix for all domains at once, however, file with all external_id
extracted from WHMCS database is required for that. The following query will retrieve such information:
SELECT tblhosting.username, mod_pleskaccounts.panelexternalid FROM mod_pleskaccounts, tblhosting where mod_pleskaccounts.userid = tblhosting.userid and tblhosting.username <> »;
For Linux
- Create a backup of psa database:# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump psa -uadmin > psa.current.sql
- Prepare a file with logins of the customers and external IDs, separated by spaces:# cat customers.txt
cus1 f8fc8a02-870a-483a-8de7-2f2cf6d16ace
edjhlbrh 1d0fa7bc-ecd8-4689-9931-99146b22a657 - Execute the following command to will take the ID and customer login from the customers.txt file and set IDs for clients with the appropriate logins:# while read i j; do plesk db «update clients set external_id=’$j’ where login=’$i'»; done < customers.txt
- Check
psa.clients
table:# plesk db «select pname,login,external_id from clients»
+——————-+———-+————————————–+
| pname | login | external_id |
+——————-+———-+————————————–+
| Administrator | admin | NULL |
| SomeCustomer | cus1 | f8fc8a02-870a-483a-8de7-2f2cf6d16ace |
| whmcsReseller | res | 1d0fa7bc-ecd8-4689-9931-99146b22a657 |
+——————-+———-+————————————–+