Closed manumitted closed 4 months ago
I'm seeing this as well. When I did occ_upgrade I get the following:
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug
Turned on maintenance mode
Updating database schema
Updated database
Updating
@s3rverro0m Thanks for the log, it's really helpful to me. Sorry if this release is causing problems, I'm trying to resolve it as soon as possible.
No worries! Happy to help.
I also have a maintenance mod. I repair this, but after, I have no code display and error in log :
"exception": {
"Exception": "OC\\DB\\Exceptions\\DbalException",
"Message": "An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column '2024-04-10' in 'where clause'",
"Code": 1054,
Query is:
SELECT `sharedAccounts`.*, `accounts`.`period`, `accounts`.`digits`, `accounts`.`type`, `accounts`.`algorithm`, `accounts`.`counter`, `accounts`.`user_id` FROM `oc_otpmanager_shared` `sharedAccounts` INNER JOIN `oc_otpmanager_accounts` `accounts` ON sharedAccounts.account_id = accounts.id WHERE (`receiver_id` = :dcValue1) AND ((`expired_at` IS NULL) OR (`expired_at` >= `2024-04-10`))
I'm also confirming this issue on Nextcloud 28.0.4 and php8.2
From what I'm seeing, you have added new table oc_otpmanager_shared
that didn't exist earlier.
And is empty...
DbalExceptionAn exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column '2024-04-10' in 'where clause'
Exception Undefined constant OCA\OtpManager\AppInfo\Application::SHARED_ACCOUNTS_DB in file '/var/www/nextcloud/apps/otpmanager/lib/Migration/Version000013Date20240213150000.php' line 19
Edit: I reinstalled the app by clearing the database and putting the earlier version manually in the Nextcloud app folder. I lost data thou, but I don't care :P.
DELETE FROM `oc_appconfig` WHERE appid='otpmanager';
DELETE FROM `oc_notifications` WHERE app='otpmanager';
DELETE FROM `oc_migrations` WHERE app='otpmanager';
DELETE FROM `oc_preferences` WHERE appid='otpmanager';
DROP TABLE oc_otpmanager_accounts;
DROP TABLE oc_otpmanager_shared;
DROP TABLE oc_otpmanager_settings;
Hello, I can also confirm the errors. Unfortunately, the app for IOS no longer works as a result.
Hello!
this also happened to me. I could get my nextcloud back working by resetting maintenance mode via setting maintenance => false in /config/config.php and running upgrade to repair. Then I installed the previous version manually like @PolishTanker .. Here you can take a look at my log: nextcloud.log
I Think this is the error:
{"reqId":"pIKzfFMYhHa7i5a8hFU5","level":3,"time":"2024-04-10T18:16:03+00:00","remoteAddr":"---IP---","user":"---USER---","app":"index","method":"GET","url":"/index.php/settings/apps/update/otpmanager","message":"Undefined constant OCA\\OtpManager\\AppInfo\\Application::SHARED_ACCOUNTS_DB in file '/var/www/vhosts/hosting/httpdocs1/apps/otpmanager/lib/Migration/Version000013Date20240213150000.php' line 19","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:124.0) Gecko/20100101 Firefox/124.0","version":"28.0.4.1","exception":{"Exception":"Exception","Message":"Undefined constant OCA\\OtpManager\\AppInfo\\Application::SHARED_ACCOUNTS_DB in file '/var/www/vhosts/hosting/httpdocs1/apps/otpmanager/lib/Migration/Version000013Date20240213150000.php' line 19","Code":0,"Trace":[{"file":"/var/www/vhosts/hosting/httpdocs1/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Settings\\Controller\\AppSettingsController"],"updateApp"]},{"file":"/var/www/vhosts/hosting/httpdocs1/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Settings\\Controller\\AppSettingsController","updateApp",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["otpmanager","settings.AppSettings.updateApp"]]},{"file":"/var/www/vhosts/hosting/httpdocs1/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/settings/apps/update/otpmanager"]},{"file":"/var/www/vhosts/hosting/httpdocs1/index.php","line":39,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/vhosts/hosting/httpdocs1/lib/private/AppFramework/Http/Dispatcher.php","Line":169,"Previous":{"Exception":"Error","Message":"Undefined constant OCA\\OtpManager\\AppInfo\\Application::SHARED_ACCOUNTS_DB","Code":0,"Trace":[{"file":"/var/www/vhosts/hosting/httpdocs1/lib/private/DB/MigrationService.php","line":518,"function":"changeSchema","class":"OCA\\OtpManager\\Migration\\Version000013Date20240213150000","type":"->","args":[["OC\\Migration\\SimpleOutput"],["Closure"],["oc_"]]},{"file":"/var/www/vhosts/hosting/httpdocs1/lib/private/DB/MigrationService.php","line":409,"function":"executeStep","class":"OC\\DB\\MigrationService","type":"->","args":["000013Date20240213150000",false]},{"file":"/var/www/vhosts/hosting/httpdocs1/lib/private/legacy/OC_App.php","line":775,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->","args":[]},{"file":"/var/www/vhosts/hosting/httpdocs1/lib/private/Installer.php","line":202,"function":"updateApp","class":"OC_App","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/vhosts/hosting/httpdocs1/apps/settings/lib/Controller/AppSettingsController.php","line":538,"function":"updateAppstoreApp","class":"OC\\Installer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/vhosts/hosting/httpdocs1/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"updateApp","class":"OCA\\Settings\\Controller\\AppSettingsController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/vhosts/hosting/httpdocs1/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Settings\\Controller\\AppSettingsController"],"updateApp"]},{"file":"/var/www/vhosts/hosting/httpdocs1/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Settings\\Controller\\AppSettingsController"],"updateApp"]},{"file":"/var/www/vhosts/hosting/httpdocs1/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Settings\\Controller\\AppSettingsController","updateApp",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["*** sensitive parameters replaced ***","settings.AppSettings.updateApp"]]},{"file":"/var/www/vhosts/hosting/httpdocs1/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/settings/apps/update/otpmanager"]},{"file":"/var/www/vhosts/hosting/httpdocs1/index.php","line":39,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/vhosts/hosting/httpdocs1/apps/otpmanager/lib/Migration/Version000013Date20240213150000.php","Line":19},"message":"Undefined constant OCA\\OtpManager\\AppInfo\\Application::SHARED_ACCOUNTS_DB in file '/var/www/vhosts/hosting/httpdocs1/apps/otpmanager/lib/Migration/Version000013Date20240213150000.php' line 19","exception":{},"CustomMessage":"Undefined constant OCA\\OtpManager\\AppInfo\\Application::SHARED_ACCOUNTS_DB in file '/var/www/vhosts/hosting/httpdocs1/apps/otpmanager/lib/Migration/Version000013Date20240213150000.php' line 19"}}
or this one:
{"reqId":"v68kD1RFAitSymVx463U","level":3,"time":"2024-04-10T18:24:51+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Database error when running migration 000013Date20240213150000 for app otpmanager\nAn exception occurred while executing a query: SQLSTATE[HY000]: General error: 1824 Failed to open the referenced table 'otpmanager_accounts'","userAgent":"--","version":"28.0.4.1","exception":{"Exception":"Exception","Message":"Database error when running migration 000013Date20240213150000 for app otpmanager\nAn exception occurred while executing a query: SQLSTATE[HY000]: General error: 1824 Failed to open the referenced table 'otpmanager_accounts'","Code":0,"Trace":[{"file":"/httpdocs1/lib/private/legacy/OC_App.php","line":775,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->","args":[]},{"file":"/httpdocs1/lib/private/Updater.php","line":360,"function":"updateApp","class":"OC_App","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/httpdocs1/lib/private/Updater.php","line":272,"function":"doAppUpgrade","class":"OC\\Updater","type":"->","args":[]},{"file":"/httpdocs1/lib/private/Updater.php","line":140,"function":"doUpgrade","class":"OC\\Updater","type":"->","args":["28.0.4.1","28.0.4.1"]},{"file":"/httpdocs1/core/Command/Upgrade.php","line":222,"function":"upgrade","class":"OC\\Updater","type":"->","args":[]},{"file":"/httpdocs1/3rdparty/symfony/console/Command/Command.php","line":298,"function":"execute","class":"OC\\Core\\Command\\Upgrade","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/httpdocs1/3rdparty/symfony/console/Application.php","line":1040,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/httpdocs1/3rdparty/symfony/console/Application.php","line":301,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["OC\\Core\\Command\\Upgrade"],["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/httpdocs1/3rdparty/symfony/console/Application.php","line":171,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/httpdocs1/lib/private/Console/Application.php","line":213,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/httpdocs1/console.php","line":100,"function":"run","class":"OC\\Console\\Application","type":"->","args":[]},{"file":"/httpdocs1/occ","line":11,"args":["/httpdocs1/console.php"],"function":"require_once"}],"File":"/httpdocs1/lib/private/DB/MigrationService.php","Line":413,"Previous":{"Exception":"Doctrine\\DBAL\\Exception\\DriverException","Message":"An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1824 Failed to open the referenced table 'otpmanager_accounts'","Code":1824,"Trace":[{"file":"/httpdocs1/3rdparty/doctrine/dbal/src/Connection.php","line":1938,"function":"convert","class":"Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter","type":"->","args":[["Doctrine\\DBAL\\Driver\\PDO\\Exception"],["Doctrine\\DBAL\\Query"]]},{"file":"/httpdocs1/3rdparty/doctrine/dbal/src/Connection.php","line":1880,"function":"handleDriverException","class":"Doctrine\\DBAL\\Connection","type":"->","args":[["Doctrine\\DBAL\\Driver\\PDO\\Exception"],["Doctrine\\DBAL\\Query"]]},{"file":"/httpdocs1/3rdparty/doctrine/dbal/src/Connection.php","line":1105,"function":"convertExceptionDuringQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":[["Doctrine\\DBAL\\Driver\\PDO\\Exception"],"ALTER TABLE oc_otpmanager_shared ADD CONSTRAINT FK_4ABB45D39B6B5FBA FOREIGN KEY (account_id) REFERENCES otpmanager_accounts (id) ON DELETE CASCADE",[],[]]},{"file":"/httpdocs1/lib/private/DB/Connection.php","line":261,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":["ALTER TABLE oc_otpmanager_shared ADD CONSTRAINT FK_4ABB45D39B6B5FBA FOREIGN KEY (account_id) REFERENCES otpmanager_accounts (id) ON DELETE CASCADE",[],[],null]},{"file":"/httpdocs1/lib/private/DB/Migrator.php","line":162,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->","args":["ALTER TABLE oc_otpmanager_shared ADD CONSTRAINT FK_4ABB45D39B6B5FBA FOREIGN KEY (account_id) REFERENCES otpmanager_accounts (id) ON DELETE CASCADE"]},{"file":"/httpdocs1/lib/private/DB/Migrator.php","line":67,"function":"applySchema","class":"OC\\DB\\Migrator","type":"->","args":[["Doctrine\\DBAL\\Schema\\Schema"]]},{"file":"/httpdocs1/lib/private/DB/Connection.php","line":588,"function":"migrate","class":"OC\\DB\\Migrator","type":"->","args":[["Doctrine\\DBAL\\Schema\\Schema"]]},{"file":"/httpdocs1/lib/private/DB/MigrationService.php","line":529,"function":"migrateToSchema","class":"OC\\DB\\Connection","type":"->","args":[["Doctrine\\DBAL\\Schema\\Schema"]]},{"file":"/httpdocs1/lib/private/DB/MigrationService.php","line":409,"function":"executeStep","class":"OC\\DB\\MigrationService","type":"->","args":["000013Date20240213150000",false]},{"file":"/httpdocs1/lib/private/legacy/OC_App.php","line":775,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->","args":[]},{"file":"/httpdocs1/lib/private/Updater.php","line":360,"function":"updateApp","class":"OC_App","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/httpdocs1/lib/private/Updater.php","line":272,"function":"doAppUpgrade","class":"OC\\Updater","type":"->","args":[]},{"file":"/httpdocs1/lib/private/Updater.php","line":140,"function":"doUpgrade","class":"OC\\Updater","type":"->","args":["28.0.4.1","28.0.4.1"]},{"file":"/httpdocs1/core/Command/Upgrade.php","line":222,"function":"upgrade","class":"OC\\Updater","type":"->","args":[]},{"file":"/httpdocs1/3rdparty/symfony/console/Command/Command.php","line":298,"function":"execute","class":"OC\\Core\\Command\\Upgrade","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/httpdocs1/3rdparty/symfony/console/Application.php","line":1040,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/httpdocs1/3rdparty/symfony/console/Application.php","line":301,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["OC\\Core\\Command\\Upgrade"],["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/httpdocs1/3rdparty/symfony/console/Application.php","line":171,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/httpdocs1/lib/private/Console/Application.php","line":213,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/httpdocs1/console.php","line":100,"function":"run","class":"OC\\Console\\Application","type":"->","args":[]},{"file":"/httpdocs1/occ","line":11,"args":["/httpdocs1/console.php"],"function":"require_once"}],"File":"/httpdocs1/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php","Line":117,"Previous":{"Exception":"Doctrine\\DBAL\\Driver\\PDO\\Exception","Message":"SQLSTATE[HY000]: General error: 1824 Failed to open the referenced table 'otpmanager_accounts'","Code":1824,"Trace":[{"file":"/httpdocs1/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php","line":76,"function":"new","class":"Doctrine\\DBAL\\Driver\\PDO\\Exception","type":"::","args":[["PDOException",["HY000",1824,"Failed to open the referenced table 'otpmanager_accounts'"]]]},{"file":"/httpdocs1/3rdparty/doctrine/dbal/src/Connection.php","line":1100,"function":"query","class":"Doctrine\\DBAL\\Driver\\PDO\\Connection","type":"->","args":["ALTER TABLE oc_otpmanager_shared ADD CONSTRAINT FK_4ABB45D39B6B5FBA FOREIGN KEY (account_id) REFERENCES otpmanager_accounts (id) ON DELETE CASCADE"]},{"file":"/httpdocs1/lib/private/DB/Connection.php","line":261,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":["ALTER TABLE oc_otpmanager_shared ADD CONSTRAINT FK_4ABB45D39B6B5FBA FOREIGN KEY (account_id) REFERENCES otpmanager_accounts (id) ON DELETE CASCADE",[],[],null]},{"file":"/httpdocs1/lib/private/DB/Migrator.php","line":162,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->","args":["ALTER TABLE oc_otpmanager_shared ADD CONSTRAINT FK_4ABB45D39B6B5FBA FOREIGN KEY (account_id) REFERENCES otpmanager_accounts (id) ON DELETE CASCADE"]},{"file":"/httpdocs1/lib/private/DB/Migrator.php","line":67,"function":"applySchema","class":"OC\\DB\\Migrator","type":"->","args":[["Doctrine\\DBAL\\Schema\\Schema"]]},{"file":"/httpdocs1/lib/private/DB/Connection.php","line":588,"function":"migrate","class":"OC\\DB\\Migrator","type":"->","args":[["Doctrine\\DBAL\\Schema\\Schema"]]},{"file":"/httpdocs1/lib/private/DB/MigrationService.php","line":529,"function":"migrateToSchema","class":"OC\\DB\\Connection","type":"->","args":[["Doctrine\\DBAL\\Schema\\Schema"]]},{"file":"/httpdocs1/lib/private/DB/MigrationService.php","line":409,"function":"executeStep","class":"OC\\DB\\MigrationService","type":"->","args":["000013Date20240213150000",false]},{"file":"/httpdocs1/lib/private/legacy/OC_App.php","line":775,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->","args":[]},{"file":"/httpdocs1/lib/private/Updater.php","line":360,"function":"updateApp","class":"OC_App","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/httpdocs1/lib/private/Updater.php","line":272,"function":"doAppUpgrade","class":"OC\\Updater","type":"->","args":[]},{"file":"/httpdocs1/lib/private/Updater.php","line":140,"function":"doUpgrade","class":"OC\\Updater","type":"->","args":["28.0.4.1","28.0.4.1"]},{"file":"/httpdocs1/core/Command/Upgrade.php","line":222,"function":"upgrade","class":"OC\\Updater","type":"->","args":[]},{"file":"/httpdocs1/3rdparty/symfony/console/Command/Command.php","line":298,"function":"execute","class":"OC\\Core\\Command\\Upgrade","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/httpdocs1/3rdparty/symfony/console/Application.php","line":1040,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/httpdocs1/3rdparty/symfony/console/Application.php","line":301,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["OC\\Core\\Command\\Upgrade"],["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/httpdocs1/3rdparty/symfony/console/Application.php","line":171,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/httpdocs1/lib/private/Console/Application.php","line":213,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/httpdocs1/console.php","line":100,"function":"run","class":"OC\\Console\\Application","type":"->","args":[]},{"file":"/httpdocs1/occ","line":11,"args":["/httpdocs1/console.php"],"function":"require_once"}],"File":"/httpdocs1/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php","Line":28,"Previous":{"Exception":"PDOException","Message":"SQLSTATE[HY000]: General error: 1824 Failed to open the referenced table 'otpmanager_accounts'","Code":"HY000","Trace":[{"file":"/httpdocs1/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php","line":71,"function":"query","class":"PDO","type":"->","args":["ALTER TABLE oc_otpmanager_shared ADD CONSTRAINT FK_4ABB45D39B6B5FBA FOREIGN KEY (account_id) REFERENCES otpmanager_accounts (id) ON DELETE CASCADE"]},{"file":"/httpdocs1/3rdparty/doctrine/dbal/src/Connection.php","line":1100,"function":"query","class":"Doctrine\\DBAL\\Driver\\PDO\\Connection","type":"->","args":["ALTER TABLE oc_otpmanager_shared ADD CONSTRAINT FK_4ABB45D39B6B5FBA FOREIGN KEY (account_id) REFERENCES otpmanager_accounts (id) ON DELETE CASCADE"]},{"file":"/httpdocs1/lib/private/DB/Connection.php","line":261,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":["ALTER TABLE oc_otpmanager_shared ADD CONSTRAINT FK_4ABB45D39B6B5FBA FOREIGN KEY (account_id) REFERENCES otpmanager_accounts (id) ON DELETE CASCADE",[],[],null]},{"file":"/httpdocs1/lib/private/DB/Migrator.php","line":162,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->","args":["ALTER TABLE oc_otpmanager_shared ADD CONSTRAINT FK_4ABB45D39B6B5FBA FOREIGN KEY (account_id) REFERENCES otpmanager_accounts (id) ON DELETE CASCADE"]},{"file":"/httpdocs1/lib/private/DB/Migrator.php","line":67,"function":"applySchema","class":"OC\\DB\\Migrator","type":"->","args":[["Doctrine\\DBAL\\Schema\\Schema"]]},{"file":"/httpdocs1/lib/private/DB/Connection.php","line":588,"function":"migrate","class":"OC\\DB\\Migrator","type":"->","args":[["Doctrine\\DBAL\\Schema\\Schema"]]},{"file":"/httpdocs1/lib/private/DB/MigrationService.php","line":529,"function":"migrateToSchema","class":"OC\\DB\\Connection","type":"->","args":[["Doctrine\\DBAL\\Schema\\Schema"]]},{"file":"/httpdocs1/lib/private/DB/MigrationService.php","line":409,"function":"executeStep","class":"OC\\DB\\MigrationService","type":"->","args":["000013Date20240213150000",false]},{"file":"/httpdocs1/lib/private/legacy/OC_App.php","line":775,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->","args":[]},{"file":"/httpdocs1/lib/private/Updater.php","line":360,"function":"updateApp","class":"OC_App","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/httpdocs1/lib/private/Updater.php","line":272,"function":"doAppUpgrade","class":"OC\\Updater","type":"->","args":[]},{"file":"/httpdocs1/lib/private/Updater.php","line":140,"function":"doUpgrade","class":"OC\\Updater","type":"->","args":["28.0.4.1","28.0.4.1"]},{"file":"/httpdocs1/core/Command/Upgrade.php","line":222,"function":"upgrade","class":"OC\\Updater","type":"->","args":[]},{"file":"/httpdocs1/3rdparty/symfony/console/Command/Command.php","line":298,"function":"execute","class":"OC\\Core\\Command\\Upgrade","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/httpdocs1/3rdparty/symfony/console/Application.php","line":1040,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/httpdocs1/3rdparty/symfony/console/Application.php","line":301,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["OC\\Core\\Command\\Upgrade"],["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/httpdocs1/3rdparty/symfony/console/Application.php","line":171,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/httpdocs1/lib/private/Console/Application.php","line":213,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->","args":[["Symfony\\Component\\Console\\Input\\ArgvInput"],["Symfony\\Component\\Console\\Output\\ConsoleOutput"]]},{"file":"/httpdocs1/console.php","line":100,"function":"run","class":"OC\\Console\\Application","type":"->","args":[]},{"file":"/httpdocs1/occ","line":11,"args":["/httpdocs1/console.php"],"function":"require_once"}],"File":"/httpdocs1/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php","Line":71}}},"message":"Database error when running migration 000013Date20240213150000 for app otpmanager\nAn exception occurred while executing a query: SQLSTATE[HY000]: General error: 1824 Failed to open the referenced table 'otpmanager_accounts'","exception":{},"CustomMessage":"Database error when running migration 000013Date20240213150000 for app otpmanager\nAn exception occurred while executing a query: SQLSTATE[HY000]: General error: 1824 Failed to open the referenced table 'otpmanager_accounts'"}}
I hope I could help!
It also happened on docker image: linuxserver/nextcloud: #version: 27.1.4 Trying to update to 0.5.0 got the server stuck in maintenance.
MariaDB was looping throwing this cryptic error:
Caught SIGTERM signal! cat: /var/run/mysqld/mysqld.pid: No such file or directory
From here
the_spad https://info.linuxserver.io/issues/2023-05-29-mariadb/
If any of your databases are in an inconsistent state from an unclean shutdown or previous failed upgrade, then MariaDB will just go into a crash loop while trying to run its upgrade routines.
Removing the container, restoring a snapshot then recreating the stack solved the problem.
Confirmed the bug for 27.1.8 as well
To update you on what I'm understanding about bugs.
This morning I managed to reproduce the problem and, in my case (but I think it's what caused the problem for everyone), it was caused by the instruction that generated the foreign key:
$table->addForeignKeyConstraint(Application::ACCOUNTS_DB, ["account_id"], ["id"], ["onDelete" => "CASCADE"]);
it should have been like this instead:
$table->addForeignKeyConstraint($schema->getTable(Application::ACCOUNTS_DB), ["account_id"], ["id"], ["onDelete" => "CASCADE"]);
This is because it seems that the oc_
prefix (or whatever it is) was not added automatically.
I still don't understand how this error has never appeared to me before. The only thing I can think of is that SQLite (I used this on my nextcloud for development) didn't catch this error, while as soon as I tried with a nextcloud with mysql I immediately encountered the exception with the update (but also with simple installation).
Second problem is that even after the installation/update, this error returned (as others have already pointed out to me):
Column not found: 1054 Unknown column '2024-04-10' in 'where clause'
This can be solved by changing the way some queries were constructed:
$qb->expr()->gte('expired_at', date('Y-m-d')),
written like this no longer gives an error:
$qb->expr()->gte('expired_at', $qb->createNamedParameter(date('Y-m-d'))),
It seems that as it was written before it didn't see the argument as a value but saw it as a column of the table (also for this error I think SQLite lied to me).
Even though the errors should be resolved now, I'm still trying to understand if there may be problems for those who have already updated the extension to 0.5.0, i.e. those who have forced the update. Because I believe that the other problems that have appeared (for example Undefined constant
) are derived from these two and I don't know if they are "fixable". What do you think?
Came here waiting for a fix... The solution in https://github.com/matteo-convertino/otpmanager-nextcloud/issues/42#issuecomment-2048156376 is not working for me, as rolling back doesn't recreate the database (or, at least idk how to do)
I had also this issue. And modified the lines in the code with the expired_at query. Now i can access the codes again via web browser, but the sync with the app still gives me some errors:
POST /index.php/apps/otpmanager/accounts/sync HTTP/1.1" 405 - "-" "Dart/3.2 (dart:io)"
And the nexcloud log:
{
"reqId": "ZhfkVWOfA6V73Yi-FcZdfgAAAEE",
"level": 1,
"time": "2024-04-11T13:23:33+00:00",
"remoteAddr": "178.xxx.xxx.xxx",
"user": "--",
"app": "admin_audit",
"method": "POST",
"url": "/index.php/apps/otpmanager/accounts/sync",
"message": "Login attempt: \"username\"",
"userAgent": "Dart/3.2 (dart:io)",
"version": "28.0.3.2",
"data": {
"app": "admin_audit"
}
}
{
"reqId": "ZhfkVWOfA6V73Yi-FcZdfgAAAEE",
"level": 1,
"time": "2024-04-11T13:23:33+00:00",
"remoteAddr": "178.xxx.xxx.xxx",
"user": "username",
"app": "admin_audit",
"method": "POST",
"url": "/index.php/apps/otpmanager/accounts/sync",
"message": "Login successful: \"username\"",
"userAgent": "Dart/3.2 (dart:io)",
"version": "28.0.3.2",
"data": {
"app": "admin_audit"
}
}
Even though the errors should be resolved now, I'm still trying to understand if there may be problems for those who have already updated the extension to 0.5.0, i.e. those who have forced the update. Because I believe that the other problems that have appeared (for example
Undefined constant
) are derived from these two and I don't know if they are "fixable". What do you think?
I think step one should probably be to push the hotfix out to nextcloud so more people don't end up with the problem.
[Disclosure] I saw this thread before upgrading so I guess I'll hold off. But I have Postgre and didn't notice any issues with previous versions.
Am I understanding that the only way fix this is to delete the old tables and let it rebuild with the corrected code? If that's the case it would be nice to export the account information first...
I tried on one of my daily build nextcloud servers (which did not already have the app installed) to install the app, and it failed with
An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1005 Can't create table ncdaily
.oc_otpmanager_shared
(errno: 150 "Foreign key constraint is incorrectly formed")
If that's the case it would be nice to export the account information first...
Exporting your accounts so you have a backup is definitely the best thing.
Am I understanding that the only way fix this is to delete the old tables and let it rebuild with the corrected code?
Regarding this I would actually tell you no, there is no need to delete all the tables. Or at least I think. If a person wanted to downgrade from 0.5.0 to 0.4.0 he would have to drop the "oc_otpmanager_shared" table and delete the entry of only the latest migration (000013Date20240213150000) from "oc_migrations".
I think step one should probably be to push the hotfix out to nextcloud so more people don't end up with the problem.
Ok so now I'm releasing 0.5.1 where these problems are solved (hopefully at least). I haven't delved into the issues with the mobile app yet, but I'll do another release for those.
guys I have published the release, try to update to this when possible and let me know.
Thanks! Part of my problem is that my test system is now running NC29 RC, and this plugin isn't yet compatible, so I updated it on my production system and got a surprise.
I just upgraded from 0.4.0 to 0.5.1 unfortunately it is stuck on an error and in maintenance mode.
NC28.0.4 PostgreSQL 15.6 Php 8.3.4
Here is from the log file
{"reqId":"yrHS98zRqhDwHvz2Dfw9","level":3,"time":"April 11, 2024 11:43:41","remoteAddr":"IP","user":"myAccount","app":"index","method":"GET","url":"/settings/apps/update/otpmanager","message":"Undefined constant OCA\\OtpManager\\AppInfo\\Application::SHARED_ACCOUNTS_DB in file '/var/www/nextcloud/apps/otpmanager/lib/Migration/Version000013Date20240213150000.php' line 19","userAgent":"Mozilla/5.0 (Windows NT 10.0; rv:124.0) Gecko/20100101 Firefox/124.0","version":"28.0.4.1","exception":{"Exception":"Exception","Message":"Undefined constant OCA\\OtpManager\\AppInfo\\Application::SHARED_ACCOUNTS_DB in file '/var/www/nextcloud/apps/otpmanager/lib/Migration/Version000013Date20240213150000.php' line 19","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":39,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","Line":169,"Previous":{"Exception":"Error","Message":"Undefined constant OCA\\OtpManager\\AppInfo\\Application::SHARED_ACCOUNTS_DB","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/DB/MigrationService.php","line":518,"function":"changeSchema","class":"OCA\\OtpManager\\Migration\\Version000013Date20240213150000","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/MigrationService.php","line":409,"function":"executeStep","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":775,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/var/www/nextcloud/lib/private/Installer.php","line":202,"function":"updateApp","class":"OC_App","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/settings/lib/Controller/AppSettingsController.php","line":538,"function":"updateAppstoreApp","class":"OC\\Installer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"updateApp","class":"OCA\\Settings\\Controller\\AppSettingsController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":39,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/apps/otpmanager/lib/Migration/Version000013Date20240213150000.php","Line":19},"message":"Undefined constant OCA\\OtpManager\\AppInfo\\Application::SHARED_ACCOUNTS_DB in file '/var/www/nextcloud/apps/otpmanager/lib/Migration/Version000013Date20240213150000.php' line 19","exception":{},"CustomMessage":"Undefined constant OCA\\OtpManager\\AppInfo\\Application::SHARED_ACCOUNTS_DB in file '/var/www/nextcloud/apps/otpmanager/lib/Migration/Version000013Date20240213150000.php' line 19"}}
{EDIT}
Regarding this I would actually tell you no, there is no need to delete all the tables. Or at least I think. If a person wanted to downgrade from 0.5.0 to 0.4.0 he would have to drop the "oc_otpmanager_shared" table and delete the entry of only the latest migration (000013Date20240213150000) from "oc_migrations".
Thanks for this, I was able to revert back pretty easily.
Ok so this error reappeared. This is really very strange, I'm trying to figure out what is causing it. If you have other logs that you think might be useful, feel free to send them.
Sure, looks like there was one more
[index] Error: An exception occurred while executing a query: SQLSTATE[42P01]: Undefined table: 7 ERROR: missing FROM-clause entry for table "sharedaccounts" LINE 1: ...INNER JOIN "oc_otpmanager_accounts" "accounts" ON sharedAcco... ^ GET /index.php/apps/otpmanager/accounts from IP by myAccount at Apr 11, 2024, 4:00:01 PM
Same with my (re)installation. I switched back to 0.4.0 in the meantime.
{"reqId":"r3Kx5aPlk8U6pgcq9xBr","level":3,"time":"2024-04-11T16:47:59+00:00","remoteAddr":"---IP---","user":"---USER---","app":"index","method":"GET","url":"/index.php/settings/apps/update/otpmanager","message":"Undefined constant OCA\\OtpManager\\AppInfo\\Application::SHARED_ACCOUNTS_DB in file '/var/www/vhosts/hosting/httpdocs1/apps/otpmanager/lib/Migration/Version000013Date20240213150000.php' line 19","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0","version":"28.0.4.1","exception":{"Exception":"Exception","Message":"Undefined constant OCA\\OtpManager\\AppInfo\\Application::SHARED_ACCOUNTS_DB in file '/var/www/vhosts/hosting/httpdocs1/apps/otpmanager/lib/Migration/Version000013Date20240213150000.php' line 19","Code":0,"Trace":[{"file":"/var/www/vhosts/hosting/httpdocs1/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Settings\\Controller\\AppSettingsController"],"updateApp"]},{"file":"/var/www/vhosts/hosting/httpdocs1/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Settings\\Controller\\AppSettingsController","updateApp",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["otpmanager","settings.AppSettings.updateApp"]]},{"file":"/var/www/vhosts/hosting/httpdocs1/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/settings/apps/update/otpmanager"]},{"file":"/var/www/vhosts/hosting/httpdocs1/index.php","line":39,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/vhosts/hosting/httpdocs1/lib/private/AppFramework/Http/Dispatcher.php","Line":169,"Previous":{"Exception":"Error","Message":"Undefined constant OCA\\OtpManager\\AppInfo\\Application::SHARED_ACCOUNTS_DB","Code":0,"Trace":[{"file":"/var/www/vhosts/hosting/httpdocs1/lib/private/DB/MigrationService.php","line":518,"function":"changeSchema","class":"OCA\\OtpManager\\Migration\\Version000013Date20240213150000","type":"->","args":[["OC\\Migration\\SimpleOutput"],["Closure"],["oc_"]]},{"file":"/var/www/vhosts/hosting/httpdocs1/lib/private/DB/MigrationService.php","line":409,"function":"executeStep","class":"OC\\DB\\MigrationService","type":"->","args":["000013Date20240213150000",false]},{"file":"/var/www/vhosts/hosting/httpdocs1/lib/private/legacy/OC_App.php","line":775,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->","args":[]},{"file":"/var/www/vhosts/hosting/httpdocs1/lib/private/Installer.php","line":202,"function":"updateApp","class":"OC_App","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/vhosts/hosting/httpdocs1/apps/settings/lib/Controller/AppSettingsController.php","line":538,"function":"updateAppstoreApp","class":"OC\\Installer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/vhosts/hosting/httpdocs1/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"updateApp","class":"OCA\\Settings\\Controller\\AppSettingsController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/vhosts/hosting/httpdocs1/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Settings\\Controller\\AppSettingsController"],"updateApp"]},{"file":"/var/www/vhosts/hosting/httpdocs1/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Settings\\Controller\\AppSettingsController"],"updateApp"]},{"file":"/var/www/vhosts/hosting/httpdocs1/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Settings\\Controller\\AppSettingsController","updateApp",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["*** sensitive parameters replaced ***","settings.AppSettings.updateApp"]]},{"file":"/var/www/vhosts/hosting/httpdocs1/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/settings/apps/update/otpmanager"]},{"file":"/var/www/vhosts/hosting/httpdocs1/index.php","line":39,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/vhosts/hosting/httpdocs1/apps/otpmanager/lib/Migration/Version000013Date20240213150000.php","Line":19},"message":"Undefined constant OCA\\OtpManager\\AppInfo\\Application::SHARED_ACCOUNTS_DB in file '/var/www/vhosts/hosting/httpdocs1/apps/otpmanager/lib/Migration/Version000013Date20240213150000.php' line 19","exception":{},"CustomMessage":"Undefined constant OCA\\OtpManager\\AppInfo\\Application::SHARED_ACCOUNTS_DB in file '/var/www/vhosts/hosting/httpdocs1/apps/otpmanager/lib/Migration/Version000013Date20240213150000.php' line 19"}}
Sorry that it's another post with bad news.
I've updated and faced this error but ran the upgrade via OCC and didn't notice the error there if I did get it. From what you've said it sounds safe to just leave it as is and install the next update?
One of my logs after updating from 0.4.0 to 0.5.0 mentioned a SQL error during the migration process with SQL that was referencing the otpmanager tables without my configured dbtableprefix config value applied to the name. Maybe that’s the root?
Installed version 0.5.1 in a fresh docker-containerized instance and no problem. Maybe the proble appears if you try to upgrade
From what you've said it sounds safe to just leave it as is and install the next update?
One thing I recommend is to update from 0.4.0 -> 0.5.1 and not 0.5.0 -> 0.5.1, because most likely the correct migration is not performed (I'm taking it for granted that "no one" should have been able to update to 0.5.0).
The thing I'm not understanding is why if I try to update (0.4.0 -> 0.5.1) via "update" the error appears, but if I update manually (with occ upgrade) the error doesn't appear and everything works.
One of my logs after updating from 0.4.0 to 0.5.0 mentioned a SQL error during the migration process with SQL that was referencing the otpmanager tables without my configured dbtableprefix config value applied to the name. Maybe that’s the root?
Yes, that is an error in 0.5.0, so avoid updating to that version. In 0.5.1 this has been fixed.
Installed version 0.5.1 in a fresh docker-containerized instance and no problem. Maybe the proble appears if you try to upgrade
I had noticed this too, the error seems to only exist on the update.
Hi,
I have installed 0.5.1, and it's fix issue on webUI... But I have issue on android app... Perhaps a broken API issue ?
What do the app and nextcloud logs say?
Hello; I can also confirm that after a clean install of 0.5.1, although the web UI works again, neither the iOS nor the Android can connect anymore.
On iOS I get the password prompt, and then after entering the correct password, a message saying „You need to set a password before“. No further progress is possible. At the same time, the Nextcloud log shows „ "POST /index.php/apps/otpmanager/password/check HTTP/1.1" 404 4297 "-" "Dart/3.2 (dart:io)"
On Android I get „The Nextcloud server returns an error“, and the Nextcloud log contains "POST /index.php/apps/otpmanager/accounts/sync HTTP/1.1" 405 2215
Also tried removing and reinstalling the app, makes no difference.
Any hints, how to restore operations for the mobile apps?
Thank-you in advance,
The password check API has changed to a new url with 5.0 which is what has broken the mobile apps. I assume we're just waiting for an update for them to come through the app stores. (I've already updated my browser extension to the new url).
If you are using version 1.4.5 it is normal, that is not compatible with the extension >=0.5.0. You should try 1.5.0. Google hasn't published it on the play store yet, if you want you can use the apk directly from the release on Github.
This version incompatibility thing will be more "user friendly" (i.e. a correct error message will be shown) in future releases.
I‘m using the latest version which is available on both application stores, how am I supposed to know that they wouldn‘t work with the lastest Nextcloud app version? I can‘t remember reading any advice in this sense on the installation screen, sorry.
no worries, you're right, now it's not shown anywhere but already in subsequent releases it is. For now it is enough to know that to work the mobile app must be >=1.5.0 and the nextcloud extension >=0.5.0.
Solution: Stay with 0.4.0 for a couple of months more 🤣
So, in the morning I've tried to update through web to 0.5.0 and got the error with maintenance mode window.
Afterwards, I replaced the apps folder with the previous version of 0.4.0. It works through web, but the Chrome extension denies to work saying Failed to check password
In the evening I tried to update to v.0.5.1 through web and stuck again with the maintenance mode window. Replaced the app folder with the v.0.4.0 and tried to update manually, got this error:
sudo -u www-data php /var/www/nextcloud/occ app:update otpmanager
otpmanager new version available: 0.5.1
An unhandled exception has been thrown:
Error: Undefined constant OCA\OtpManager\AppInfo\Application::SHARED_ACCOUNTS_DB in /var/www/html/nextcloud/apps/otpmanager/lib/Migration/Version000013Date20240213150000.php:19
Stack trace:
#0 /var/www/html/nextcloud/lib/private/DB/MigrationService.php(528): OCA\OtpManager\Migration\Version000013Date20240213150000->changeSchema()
#1 /var/www/html/nextcloud/lib/private/DB/MigrationService.php(418): OC\DB\MigrationService->executeStep()
#2 /var/www/html/nextcloud/lib/private/legacy/OC_App.php(844): OC\DB\MigrationService->migrate()
#3 /var/www/html/nextcloud/lib/private/Installer.php(201): OC_App::updateApp()
#4 /var/www/html/nextcloud/core/Command/App/Update.php(107): OC\Installer->updateAppstoreApp()
#5 /var/www/html/nextcloud/3rdparty/symfony/console/Command/Command.php(298): OC\Core\Command\App\Update->execute()
#6 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run()
#7 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#8 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#9 /var/www/html/nextcloud/lib/private/Console/Application.php(218): Symfony\Component\Console\Application->run()
#10 /var/www/html/nextcloud/console.php(100): OC\Console\Application->run()
#11 /var/www/html/nextcloud/occ(11): require_once('...')
The Chrome app doesn't work, in the NC logs I see:
[index] Error: Exception: Undefined constant OCA\OtpManager\AppInfo\Application::SHARED_ACCOUNTS_DB in file '/var/www/html/nextcloud/apps/otpmanager/lib/Migration/Version000013Date20240213150000.php' line 19 at <<closure>>
0. /var/www/html/nextcloud/lib/private/AppFramework/App.php line 183
OC\AppFramework\Http\Dispatcher->dispatch()
1. /var/www/html/nextcloud/lib/private/Route/Router.php line 315
OC\AppFramework\App::main()
2. /var/www/html/nextcloud/lib/base.php line 1068
OC\Route\Router->match()
3. /var/www/html/nextcloud/index.php line 38
OC::handleRequest()
Caused by:
Error: Undefined constant OCA\OtpManager\AppInfo\Application::SHARED_ACCOUNTS_DB at <<closure>>
0. /var/www/html/nextcloud/lib/private/DB/MigrationService.php line 528
OCA\OtpManager\Migration\Version000013Date20240213150000->changeSchema()
1. /var/www/html/nextcloud/lib/private/DB/MigrationService.php line 418
OC\DB\MigrationService->executeStep()
2. /var/www/html/nextcloud/lib/private/legacy/OC_App.php line 844
OC\DB\MigrationService->migrate()
3. /var/www/html/nextcloud/lib/private/Installer.php line 201
OC_App::updateApp("*** sensitive parameters replaced ***")
4. /var/www/html/nextcloud/apps/settings/lib/Controller/AppSettingsController.php line 535
OC\Installer->updateAppstoreApp("*** sensitive parameters replaced ***")
5. /var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 230
OCA\Settings\Controller\AppSettingsController->updateApp("*** sensitive parameters replaced ***")
6. /var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 137
OC\AppFramework\Http\Dispatcher->executeController()
7. /var/www/html/nextcloud/lib/private/AppFramework/App.php line 183
OC\AppFramework\Http\Dispatcher->dispatch()
8. /var/www/html/nextcloud/lib/private/Route/Router.php line 315
OC\AppFramework\App::main()
9. /var/www/html/nextcloud/lib/base.php line 1068
OC\Route\Router->match()
10. /var/www/html/nextcloud/index.php line 38
OC::handleRequest()
GET /settings/apps/update/otpmanager
from 100.96.1.17 by ostasevych at 2024-04-12T20:35:58+03:00
I dropped table nextcloud.oc_otpmanager_shared
and removed the last migrations, tried to re-upgrade, and got a new exception:
Exception: Database error when running migration 000011Date20240127121000 for app otpmanager The column 'icon' on table 'oc_otpmanager_accounts' already exists.
The structure of the table oc_otpmanager_accounts:
+------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| secret | varchar(512) | NO | UNI | NULL | |
| name | varchar(256) | NO | | NULL | |
| issuer | varchar(256) | NO | | NULL | |
| digits | int(11) | YES | | NULL | |
| type | varchar(4) | NO | | NULL | |
| period | int(11) | YES | | NULL | |
| algorithm | int(11) | NO | | NULL | |
| counter | int(11) | YES | | NULL | |
| position | int(11) | YES | | NULL | |
| user_id | varchar(64) | NO | MUL | NULL | |
| created_at | datetime | YES | | NULL | |
| updated_at | datetime | YES | | NULL | |
| deleted_at | datetime | YES | | NULL | |
| icon | varchar(255) | YES | | default | |
+------------+--------------+------+-----+---------+----------------+
So, how to fix that? Either to make 0.4.0 working again on Chrome apps or finish upgrade properly?
UPD: fixed with this scenario:
DELETE FROM `oc_appconfig` WHERE appid='otpmanager';
DELETE FROM `oc_notifications` WHERE app='otpmanager';
DELETE FROM `oc_migrations` WHERE app='otpmanager';
DELETE FROM `oc_preferences` WHERE appid='otpmanager';
DROP TABLE oc_otpmanager_accounts;
DROP TABLE oc_otpmanager_shared;
DROP TABLE oc_otpmanager_settings;
So, my suggestion is to include these steps into the update script if a user is on v0.5.0.
The "failed to check password" for the browser extension is already reported and as is the reason why. Do bear in mind that it is a separate project to this one. He will get to it when he can to make it more robust. https://github.com/beatles1/simple-otpmanager-browser/issues/5
[EDIT] I tried the install 0.5.1 from a clean database as per above but unfortunately while it installs, it doesn't show the otp codes and just spins.
Is the same error as before on my logs
DbalException An exception occurred while executing a query: SQLSTATE[42P01]: Undefined table: 7 ERROR: missing FROM-clause entry for table "sharedaccounts" LINE 1: ...INNER JOIN "oc_otpmanager_accounts" "accounts" ON sharedAcco... ^
In which case there is more then one thing going on here.
I bet this particular issue of mine is a pgsql thing. Something to do with the ordering with way oc_otpmanager_shared depends on oc_otpmanager_accounts with the foreign keys. Or at least that is what was suggested with something similar:
(Not really a SQL guy myself, just enough to drop the wrong table, lol)
Guys tomorrow morning I will publish 0.5.2 which will solve the problem (obviously hopefully for everyone).
one thing that must be done in order to successfully update the app, for all those who are stuck between updates and migrations that fail, is to downgrade to 0.4.0 so as to have a clean app without errors for the next release:
delete the oc_otpmanager_shared
table
DROP TABLE oc_otpmanager_shared;
delete only the latest migration
DELETE FROM oc_migrations WHERE app="otpmanager" AND version="000013Date20240213150000";
delete other information regarding the status of the app
DELETE FROM oc_appconfig WHERE appid="otpmanager";
you need to manually delete the otpmanager app from the "custom_apps" folder (or whatever you have) and replace it with version 0.4.0.
Once you are at 0.4.0 and checked that everything works correctly as before, wait for the new release (0.5.2) before trying to update. (in my case I actually managed to force the update to 0.5.1 after going to maintenance with ./occ upgrade
, but as far as I understand it doesn't work for everyone).
For the more curious/technical:
I looked for the "undefined constant" error and noticed that another extension had also encountered it: https://github.com/nextcloud/fulltextsearch/issues/698
The only similarity between the errors I found was that we were both trying to access a static attribute of a class within the migration. So I investigated how other extensions handled table names and whether they had another solution. The answer is that they insert the table name string everywhere. So instead of calling a Utils::table_name
they directly do "oc_table_name"
.
I'm not looking for any other information about it but I think it's how nextcloud handles migration execution that can lead to a problem like this.
The fact is that now to solve the problem I am replacing, in all migrations, the static attribute with the table name string directly.
I apologize for these two serious errors we encountered. Nextcloud's poor documentation regarding certain topics didn't help.
However, just to be clear, you don't need to drop all the tables to make it work, I don't want you to lose your accounts obviously (this experience has taught me that it's important to export accounts, I hope you too).
DbalException An exception occurred while executing a query: SQLSTATE[42P01]: Undefined table: 7 ERROR: missing FROM-clause entry for table "sharedaccounts" LINE 1: ...INNER JOIN "oc_otpmanager_accounts" "accounts" ON sharedAcco... ^
@JoshuaPettus this error is new to me now, so I would tell you to wait until tomorrow when I publish the release and after updating check if you still have the problem.
Off topic:
As for the apps, I don't know why Google is taking so long to review the app. However you can find the apk in the release. Tomorrow morning I will also insert the ipa for those who have iOS.
Will do, unfortunately tomorrow is quite busy all day but I'll let you know when I'm able to give it a try.
I just released 0.5.2. Remember that in order to update to the new version you must first downgrade to 0.4.0 (as I wrote in the previous comment).
If you update and try to access into the webapp and the spinner spins endlessly (it happened to me), don't worry, it should just be a cache problem. Refresh the page without cache and everything should work.
I also remind you that it is normal if mobile apps are unable to synchronize accounts after the update (due to incompatibility between versions).
[EDIT]
Google just released version 1.5.0 on playstore.
So I just downgraded from 0.5.1 to 0.4.0 according to your comment and then all my accounts showed up, then I upgraded to 0.5.2 and now the spinner spins endlessly again, I deleted the cache of the browser, tried on my phone too, and also just updated my app to 1.5.0, also no luck. In the Nextcloud logs, I have the following error
DbalException An exception occurred while executing a query: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "oc_otpmanager_shared" does not exist LINE 1: ..., "accounts"."counter", "accounts"."user_id" FROM "oc_otpman... ^
After update from 0.4.0 to 0.5.2 everything works fine. (Mysql, Php8.2, 28.0.4)
So I just downgraded from 0.5.1 to 0.4.0 according to your comment and then all my accounts showed up, then I upgraded to 0.5.2 and now the spinner spins endlessly again, I deleted the cache of the browser, tried on my phone too, and also just updated my a pp to 1.5.0, also no luck. In the Nextcloud logs, I have the following error
DbalException An exception occurred while executing a query: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "oc_otpmanager_shared" does not exist LINE 1: ..., "accounts"."counter", "accounts"."user_id" FROM "oc_otpman... ^
I'm also seeing this. When following your directions, none of the SQL commands worked since it said the tables don't exist:
postgres=# DROP TABLE oc_otpmanager_shared;
ERROR: table "oc_otpmanager_shared" does not exist
postgres=# DELETE FROM oc_migrations WHERE app="otpmanager" AND version="000013Date20240213150000";
ERROR: relation "oc_migrations" does not exist
LINE 1: DELETE FROM oc_migrations WHERE app="otpmanager" AND version...
^
postgres=# DELETE FROM `oc_appconfig` WHERE appid='otpmanager';
ERROR: syntax error at or near "`"
LINE 1: DELETE FROM `oc_appconfig` WHERE appid='otpmanager';
Downgrading to 0.4 did work, but after upgrading to 0.5.2, I'm back at the spinner.
Updated from 0.4.0 works like a charm. thank you.
To follow up, i realized that if you use postgres, you need to select your database before running the SQL commands. For me this was:
su postgres
psql
\c nextcloud_db
# SQL commands..
I was able to run the commands, downgrade to v0.4, then upgrade, but still no luck in getting past the spinning wheel. I did notice that when the SQL command to delete the migration failed for me, so maybe that has something to do with it.
I also tried downgrading to v0.4, exporting all accounts, then removing all database information as described by @ostasevych in https://github.com/matteo-convertino/otpmanager-nextcloud/issues/42#issuecomment-2052209100 After removing the app and all data, then installing fresh from v0.5.2, i'm still getting an infinite spinning wheel with the following log which was also seen by @JoshuaPettus :
DbalException An exception occurred while executing a query: SQLSTATE[42P01]: Undefined table: 7 ERROR: missing FROM-clause entry for table "sharedaccounts" LINE 1: ...INNER JOIN "oc_otpmanager_accounts" "accounts" ON sharedAcco... ^
It seems to me that there must still be some remaining data in the database that is trying to cause a migration or something?
I do see the following errors in the logs:
Exception openssl_encrypt(): Argument #3 ($passphrase) must be of type string, bool given in file '/var/www/nextcloud/apps/otpmanager/lib/Utils/Encryption.php' line 37
and
hex2bin(): Input string must be hexadecimal string at /var/www/nextcloud/apps/otpmanager/lib/Utils/Encryption.php#37
Yeah just had the same thing with 0.5.2. Nice to know someone else with postgres had the issue. Seems to be a commonality
I'm even getting the spinny wheel on v0.4.0 after removing all the database tables listed above, and i don't see any errors in the logs. I cant seem to get a fresh install working. Maybe it's some kind of postgres related issue?
@JoshuaPettus are you running the Nextcloud VM (or vm scripts)? I think the issue is that the official nextcloud VM (and vm scripts) use the 'postgres' user for the nextcloud database rather than the 'ncadmin' user which the Migrations are trying to use.
@meichthys @JoshuaPettus I'm sorry I can't test the app on postgres now, however I will keep the issue open to understand whether the problem has been solved for others or not. If you believe that the problem is only with postgres (at the moment I really don't know), I would tell you to open another issue just to be more tidy.
Probably not a Postgres problem. I'm running dockerized nextcloud (AIO), OTP was functioning normally until yesterday, but then I performed a full automatic upgrade (both nextcloud and plugins), and OTP stopped functioning (is now version 0.5.2). I see the neverending spinner since then, and both android app and browser plugin don't work. And it's on MySQL.
I'll have to get to the console to debug this further, but updating the app on my system caused it to immediately go into maintenance mode.