Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nextcloud.occ social:reset produces error #1129

Closed
seahost opened this issue Nov 15, 2020 · 14 comments · Fixed by #1330
Closed

nextcloud.occ social:reset produces error #1129

seahost opened this issue Nov 15, 2020 · 14 comments · Fixed by #1330
Labels
bug Something isn't working

Comments

@seahost
Copy link

seahost commented Nov 15, 2020

Describe the bug
When running nextcloud.occ social:reset the result is the following error.

An exception occurred while executing 'DELETE FROM oc_social_3_client_auth':

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

To Reproduce
Steps to reproduce the behavior:

  1. Have social installed
  2. Run the nextcloud.occ social:reset command
  3. Error

Expected behavior
It should reset/remove the social tables from the database.

Server details **Social app version:** 0.4.1

Operating system:
Ubuntu Server 20.04.1

Nextcloud version: (see Nextcloud admin page)
Snap 20.01

Logs

Nextcloud log (data/nextcloud.log)

Insert your Nextcloud log here
o@nextcloud:~$ sudo snap run nextcloud.occ social:reset
[sudo] password for o: 
Beware, this operation will delete all content from the Social App.

Do you confirm this operation? (y/N) y
Operation is destructive. Are you sure about this? (y/N) y

flushing data... An exception occurred while executing 'DELETE FROM `oc_social_3_client_auth`':

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

</details>
@seahost seahost added the bug Something isn't working label Nov 15, 2020
@dewomser
Copy link

Same exception here

@zeitgeist87
Copy link

I can reproduce this as well.

@tim-kilian
Copy link

Same error.

@xundeenergie
Copy link

I added this two tables manually
CREATE TABLE oc_social_3_client_auth (title VARCHAR(100) NOT NULL);
CREATE TABLE oc_social_3_client_token (title VARCHAR(100) NOT NULL);
and run occ social:reset again.

Then i was asked about my base-url.

But then i got another error...
`occ social:reset
Beware, this operation will delete all content from the Social App.

Do you confirm this operation? (y/N) y
Operation is destructive. Are you sure about this? (y/N) y

flushing data... done

Now is a good time to change the base address of your cloud: (http://nextcloud.example.com)
An unhandled exception has been thrown:
TypeError: Return value of "OCA\Social\Command\Reset::execute()" must be of the type int, "null" returned. in /var/www/html/custom_apps/mail/vendor/symfony/console/Command/Command.php:261
Stack trace:
#0 /var/www/html/core/Command/Base.php(169): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 /var/www/html/custom_apps/mail/vendor/symfony/console/Application.php(920): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 /var/www/html/custom_apps/mail/vendor/symfony/console/Application.php(266): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Social\Command\Reset), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /var/www/html/custom_apps/mail/vendor/symfony/console/Application.php(142): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /var/www/html/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /var/www/html/console.php(100): OC\Console\Application->run()
#6 /var/www/html/occ(11): require_once('/var/www/html/c...')
`

@ozls
Copy link

ozls commented Dec 9, 2020

I managed to get around this bug by creating manually the two missing tables:
create table oc_social_3_client_auth (nocolumn int);
create table oc_social_3_client_token (nocolumn int);

@JOduMonT
Copy link

JOduMonT commented Jan 5, 2021

same here with nextcloud 20 and postgres

@seth586
Copy link

seth586 commented Jan 11, 2021

+1 same here can reproduce, nextcloud 20 & mariadb

@stefan123t
Copy link
Contributor

I checked code in lib/Db/CoreRequestBuilder.php and it does not verify whether the tables actually have been created before emptying them. Suggesting to enclose it in function emptyAll() like in the other uninstallSocialTables() method.

                    if ($schema->hasTable($table)) {
                         $qb->delete($table);
                    }

@sledz
Copy link

sledz commented Nov 20, 2021

Now is a good time to change the base address of your cloud: (http://nextcloud.example.com)
An unhandled exception has been thrown:
TypeError: Return value of "OCA\Social\Command\Reset::execute()" must be of the type int, "null" returned. in /var/www/html/custom_apps/mail/vendor/symfony/console/Command/Command.php:261

I see the same behavior here. Is there a fix or workaround for this in the meantime?

@stefan123t
Copy link
Contributor

@sledz workaround has been documented above and works around successfully. same for the fix it has been suggested but afaik not yet implemented / submitted as a pull request. Shame on me, I do not know how to handle that yet on my command line git.

@sledz
Copy link

sledz commented Nov 22, 2021

@stefan123t I am unsure exactly what the "documented workaround" is supposed to be?

@stefan123t
Copy link
Contributor

Both @xundeenergie and @ozls did create the two missing tables in order to call occ social:reset

The proposed fix should verify and delete only existing tables. Hence if they are missing, they need not be deleted or purged from the Database repository whatever the DB backend is (MariaDB, MySQL, PostGreSQL, you name it).

Kind regards,
Stefan

@stefan123t
Copy link
Contributor

I have submitted the above PR #1330 to fix the issue at hand, i.e. trying to empty tables which do not exist.
Unfortunately the @continuous-integration/drone/pr is failing to get the CA certificate for the dependency on friendi.ca
Maybe someone of the friendly developers at nextcloud/social (eg. @juliushaertl) knows how to restart the CI engine and merge the code ?

@sledz
Copy link

sledz commented Nov 23, 2021

@stefan123t I tried to apply your patch stefan123t@17666a5 manually. But after that the assertion only changed to:

flushing data... An unhandled exception has been thrown: Error: Call to a member function hasTable() on null in /srv/www/htdocs/nextcloud/apps/social/lib/Db/CoreRequestBuilder.php:1204

So this does not really seems to be the solution. 🤔

CarlSchwan added a commit that referenced this issue May 9, 2022
fix #1129 empty only existing tables in emptyAll()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants