Issues with deleting a site via Nexus, helper script, and API.

I attempted to install a site in the dashboard’s Nexus page. It installed with fatal errors due to not existing in cloudflare as it should have existed. I logged into the site and saw * Common_Module::set_user_preferences(): failed to open preferences files for user 'admin-myadmin'. After properly adding the domain in cloudflare I decided to delete the site in Nexus and try again. The site showed an error when I attempted to delete it though it disappeared from Nexus. In the CLI I attempted to delete the site through various means but am now stuck with the below errors. Any recommendations? Are there other ways aside from the helper scripts or API to delete the site in case the helper script and API cannot immediately solve an issue?

ERROR   : Auth_Info_User::initializeUser(): mydomain.com: domain not found in lookup table
 0. Error_Reporter::add_error("mydomain.com: domain not found in lookup table", )
        [/usr/local/apnscp/lib/log_wrapper.php:62]
 1. error("mydomain.com: domain not found in lookup table")
        [/usr/local/apnscp/lib/Auth/Info/User.php:142]
 2. Auth_Info_User::initializeUser("admin-myadmin", "mydomain.com", null, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
        [/usr/local/apnscp/lib/Auth.php:744]
 3. Auth->initializeUser("admin-myadmin", "mydomain.com", null)
        [/usr/local/apnscp/lib/Auth/CLI.php:39]
 4. Auth_CLI->authenticate()
        [/usr/local/apnscp/lib/CLI/cmd.php:689]
 5. cli\cmd("admin-myadmin", "mydomain.com")
        [/usr/local/apnscp/bin/DeleteDomain:96]

Unauthorized
FATAL   : fatal(): failed to authenticate user `admin-myadmin'
 0. Error_Reporter::trigger_fatal("failed to authenticate user `admin-myadmin'", ["admin-myadmin"])
        [/usr/local/apnscp/lib/log_wrapper.php:45]
 1. fatal("failed to authenticate user `%s'", "admin-myadmin")
        [/usr/local/apnscp/lib/Auth/CLI.php:40]
 2. Auth_CLI->authenticate()
        [/usr/local/apnscp/lib/CLI/cmd.php:689]
 3. cli\cmd("admin-myadmin", "mydomain.com")
        [/usr/local/apnscp/bin/DeleteDomain:96]

ERROR: Auth_Info_User::initializeUser(): mydomain.com: domain not found in lookup table
ERROR: fatal(): failed to authenticate user `admin-myadmin'

Can you reliably reproduce this and PM me it or email to matt@apisnetworks.com?

Usually what happens here is that a token is specified instead of a key or a token is specified that lacks requisite permissions, chiefly Zone.Zone.

There’s a cache in the frontend that cycles every 10 minutes, which if you deleted from backend - as I imagine - isn’t reconciled to frontend immediately.

When in doubt mapCheck.php will clear things up, but do isolate this to something I can reliably reproduce. Next release is out Monday :+1:

I will try and reproduce this soon. I’m afraid I complicated my issue. Here is a bit more information - when I was debugging earlier I somehow created a duplicate entry. I did EditDomain and changed the site url in an attempt to skirt around an authentication issue that was being presented while attempting DeleteDomain, which further complicated the issue.

When I attempt to do ./scripts/mapCheck.php rebuild I get:

./scripts/mapCheck.php rebuild
INFO    : Scanning apache.domainmap
INFO    : Scanning billing.domainmap
INFO    : Scanning billing.parentmap
INFO    : Scanning domainmap
INFO    : Scanning ipmap
INFO    : Scanning mysql.prefixmap
WARNING : unknown(): site12 MISSING mysql - orphaned site?
 0. Error_Reporter::add_warning("%s MISSING %s - orphaned site?", ["site12", "mysql"])
        [/usr/local/apnscp/lib/log_wrapper.php:87]
 1. warn("%s MISSING %s - orphaned site?", "site12", "mysql")
        [/usr/local/apnscp/bin/scripts/mapCheck.php:108]

INFO    : Scanning mysql.usermap
INFO    : Scanning pgsql.prefixmap
INFO    : Scanning pgsql.usermap
INFO    : Scanning ssh.portmap
INFO    : Scanning reseller
INFO    : Scanning whitelist
INFO    : Rebuilt domainmap.tch
ERROR   : Opcenter\Database\PostgreSQL\Opcenter::createSite(): 23505: 7: ERROR:  duplicate key value violates unique constraint "siteinfo_pkey"
DETAIL:  Key (site_id)=(12) already exists.
 0. Error_Reporter::add_error("23505: 7: ERROR:  duplicate key value violates unique constraint "siteinfo_pkey"DETAIL:  Key (site_id)=(12) already exists.", )
        [/usr/local/apnscp/lib/log_wrapper.php:62]
 1. error("23505: 7: ERROR:  duplicate key value violates unique constraint "siteinfo_pkey"DETAIL:  Key (site_id)=(12) already exists.")
        [/usr/local/apnscp/lib/Opcenter/Database/PostgreSQL/Opcenter.php:84]
 2. Opcenter\Database\PostgreSQL\Opcenter->createSite(12, "mydomain-old.com", "blah@blahdomain.com", "admin-myadmin")
        [/usr/local/apnscp/bin/scripts/mapCheck.php:250]

WARNING : unknown(): failed to populate admin database entry for `mydomain-old.com' (`12')
 0. Error_Reporter::add_warning("failed to populate admin database entry for `%(domain)s' (`%(site)s')", [[domain:"mydomain-old.com", site:12]])
        [/usr/local/apnscp/lib/log_wrapper.php:87]
 1. warn("failed to populate admin database entry for `%(domain)s' (`%(site)s')", [domain:"mydomain-old.com", site:12])
        [/usr/local/apnscp/bin/scripts/mapCheck.php:254]

ERROR: Opcenter\Database\PostgreSQL\Opcenter::createSite(): 23505: 7: ERROR:  duplicate key value violates unique constraint "siteinfo_pkey"
DETAIL:  Key (site_id)=(12) already exists.

After the attempted EditDomain domain= edit, It’s now a weird mix for site12 between the new mydomain-old.com and mydomain.com
In /home/virtual/ there is a link for:
mydomain-old.com -> /home/virtual/site12/fst

And inside of /usr/local/apnscp/storage/opcenter/mappings/domainmap there is:
[DEFAULT]
mydomain.com=site12

I shouldn’t have just attempted to rename the domain name to skirt around the user authentication error that was being raised initially when trying DeleteDomain, and so if you could assist me further I would greatly appreciate it.

Here is the result of the DeleteDomain command for this site:

DeleteDomain --force site12
ERROR   : Auth_Info_User::initializeUser(): mydomain-old.com: domain not found in lookup table
 0. Error_Reporter::add_error("mydomain-old.com: domain not found in lookup table", )
        [/usr/local/apnscp/lib/log_wrapper.php:62]
 1. error("mydomain-old.com: domain not found in lookup table")
        [/usr/local/apnscp/lib/Auth/Info/User.php:142]
 2. Auth_Info_User::initializeUser("admin-myadmin", "mydomain-old.com", null, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
        [/usr/local/apnscp/lib/Auth.php:744]
 3. Auth->initializeUser("admin-myadmin", "mydomain-old.com", null)
        [/usr/local/apnscp/lib/Auth/CLI.php:39]
 4. Auth_CLI->authenticate()
        [/usr/local/apnscp/lib/CLI/cmd.php:689]
 5. cli\cmd("admin-myadmin", "mydomain-old.com")
        [/usr/local/apnscp/bin/DeleteDomain:96]

Unauthorized
FATAL   : fatal(): failed to authenticate user `admin-myadmin'
 0. Error_Reporter::trigger_fatal("failed to authenticate user `admin-myadmin'", ["admin-myadmin"])
        [/usr/local/apnscp/lib/log_wrapper.php:45]
 1. fatal("failed to authenticate user `%s'", "admin-myadmin")
        [/usr/local/apnscp/lib/Auth/CLI.php:40]
 2. Auth_CLI->authenticate()
        [/usr/local/apnscp/lib/CLI/cmd.php:689]
 3. cli\cmd("admin-myadmin", "mydomain-old.com")
        [/usr/local/apnscp/bin/DeleteDomain:96]

ERROR: Auth_Info_User::initializeUser(): mydomain-old.com: domain not found in lookup table
ERROR: fatal(): failed to authenticate user `admin-myadmin'

I was able to solve the results of the problem by first setting the domain in /usr/local/apnscp/storage/opcenter/mappings/domainmap from mydomain.com=site12 to mydomain-old.com=site12 and then running:

EditDomain -c apache,webuser=None site12
DeleteDomain --force site12

In the very beginning when I attempted to delete the site via Nexus there was initially an error related to user permissions with behavior similar to what was posted here in discord:

I will attempt to reproduce the issue soon in cloudflare as you requested to help pin down the original issue.

1 Like