simple_oauth is breaking user edit changes and wont uninstall.

Created on 18 September 2019, about 5 years ago
Updated 28 December 2023, 11 months ago

Editing a user page is causing a white screen crash with following error logs:

Type	php
Date	Wednesday, September 18, 2019 - 15:28
User	user1
Location	http://json.syntapse.co.uk/user/1/edit
Referrer	http://json.syntapse.co.uk/user/1/edit
Message	Drupal\Core\Entity\EntityStorageException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'json.oauth2_token' doesn't exist: SELECT base_table.id AS id, base_table.id AS base_table_id FROM {oauth2_token} base_table INNER JOIN {oauth2_token} oauth2_token ON oauth2_token.id = base_table.id WHERE (oauth2_token.auth_user_id = :db_condition_placeholder_0) AND (oauth2_token.bundle != :db_condition_placeholder_1); Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => refresh_token ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 847 of /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Severity	Error
Hostname	172.28.2.1
Operations	

and

Type	user
Date	Wednesday, September 18, 2019 - 15:28
User	user1
Location	http://json.syntapse.co.uk/user/1/edit
Referrer	http://json.syntapse.co.uk/user/1/edit
Message	Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'json.oauth2_token' doesn't exist: SELECT base_table.id AS id, base_table.id AS base_table_id FROM {oauth2_token} base_table INNER JOIN {oauth2_token} oauth2_token ON oauth2_token.id = base_table.id WHERE (oauth2_token.auth_user_id = :db_condition_placeholder_0) AND (oauth2_token.bundle != :db_condition_placeholder_1); Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => refresh_token ) in Drupal\simple_oauth\ExpiredCollector->collectForAccount() (line 88 of /var/www/html/web/modules/contrib/simple_oauth/src/ExpiredCollector.php).
Severity	Error
Hostname	172.28.2.1
Operations	

I cant uninstall it either


bash-4.4# drush pmu simple_oauth

In Connection.php line 692:

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'json.oauth2_token' doesn't exist: SELECT base_table.id AS id, base_table.id
  AS base_table_id
  FROM
  {oauth2_token} base_table
  LIMIT 1 OFFSET 0; Array
  (
  )

In Statement.php line 59:

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'json.oauth2_token' doesn't exist

pm:uninstall [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-d|--debug] [-y|--yes] [--no] [--remote-host REMOTE-HOST] [--remote-user REMOTE-USER] [-r|--root ROOT] [-l|--uri URI] [--simulate] [--pipe] [-D|--define DEFINE]
[--druplicon] [--xh-link XH-LINK] [--notify] [--] <command> [<modules>]...

Fortunately i'm testing on a dev site, but its basically broken after install of simple_oauth module because i cant uninstall and access user pages.

πŸ› Bug report
Status

Closed: cannot reproduce

Version

4.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom Syntapse

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States jghyde

    Let's re-open. I am getting same problem.

    When uninstalling simple_oauth from browser UI:

    Drupal\Core\Entity\EntityStorageException: The field secret has already been deleted and it is in the process of being purged. in Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->onFieldStorageDefinitionDelete() (line 762 of /var/www/sanangelolive.com/prod/docroot/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php).
    

    When drush pmu simple_oauth:

    (event *=) $ drush pmu simple_oauth
    
    In SqlContentEntityStorageSchema.php line 762:
                                                                                           
      The field secret has already been deleted and it is in the process of being purged.  
                                                                                           
    
  • πŸ‡ΊπŸ‡ΈUnited States jghyde

    Upgrading another site from 8.9 to 9.4 and this problem still persists. Where is the field "secret"? Queues have been purged; cron has been run.

  • πŸ‡ΊπŸ‡ΈUnited States jghyde

    Found a workaround solution for disabling a badly behaving simple_oauth module.

    1. Try drush pmu simple_oauth
    2. If it complains of 'field secret' try running a drush core-cron to urge Drupal to purge that field
    3. If core-cron doesn't work, look in the database for a simple_oauth_field__[random characters] with the 'secret' as the only item inside the table and then drop that table.
    4. Try to run drush pmu simple_oauth again.
    5. If it still will not uninstall because of a crazy error, it's time to remove it manually with this mysql commande:
    6 run in mysql delete from key_value where collection='system.schema' and name='simple_oauth';
    7. drush cex to export the deletion of simple_oauth from the db config to the sync yaml files
    8. Look for simple_oauth tables in the db and drop them (I didn't have any as the uninstall had removed them, thus making it impossible to get a clean drush pmu on subsequent attempts.
    9. You're done!

Production build 0.71.5 2024