nextcloud / bookmarks

🔖 Bookmark app for Nextcloud
https://apps.nextcloud.com/apps/bookmarks
GNU Affero General Public License v3.0
1.02k stars 174 forks source link

I become an Error message when opening the Bookmarks tab #1456

Closed TonKkkkk closed 3 years ago

TonKkkkk commented 3 years ago

Describe the bug After I installed the Bookmarks I once saw the correct screen. After installing Firefox Floccus plugin and succesfully adding token autentication I was not able to sync via floccus or open the bookmark screen in Nextcloud

To Reproduce Click on the Bookmarks Icon, as in the screenshot, error message as below in screenshot apears image

Expected behavior I get the Bookmarks screen, as I saw after installing

Screenshots image

Desktop (please complete the following information):

Server (please complete the following information):

Additional context Occurred after sync with floccus Firefox browser plugin sync ( probabely )

Nextcloud error log {"reqId":"g6S1oiE10m075gijFkId","level":3,"time":"2021-03-11T17:22:40+00:00","remoteAddr":"192.168.xx.xx","user":"xxx","app":"index","method":"GET","url":"/apps/bookmarks/","message":{"Exception":"Exception","Message":"Argument 1 passed to OCA\Bookmarks\Db\TreeMapper::getSubFolders() must be of the type int, null given, called in /var/www/html/custom_apps/bookmarks/lib/Controller/FoldersController.php on line 466","Code":0,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OCA\Bookmarks\Controller\WebViewController"},"index"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\AppFramework\App","type":"::","args":["OCA\Bookmarks\Controller\WebViewController","index",{"class":"OC\AppFramework\DependencyInjection\DIContainer"},{"_route":"bookmarks.web_view.index"}]},{"file":"/var/www/html/lib/base.php","line":993,"function":"match","class":"OC\Route\Router","type":"->","args":["/apps/bookmarks/"]},{"file":"/var/www/html/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","Line":159,"Previous":{"Exception":"TypeError","Message":"Argument 1 passed to OCA\Bookmarks\Db\TreeMapper::getSubFolders() must be of the type int, null given, called in /var/www/html/custom_apps/bookmarks/lib/Controller/FoldersController.php on line 466","Code":0,"Trace":[{"file":"/var/www/html/custom_apps/bookmarks/lib/Controller/FoldersController.php","line":466,"function":"getSubFolders","class":"OCA\Bookmarks\Db\TreeMapper","type":"->","args":[null,-1]},{"file":"/var/www/html/custom_apps/bookmarks/lib/Controller/WebViewController.php","line":109,"function":"getFolders","class":"OCA\Bookmarks\Controller\FoldersController","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":218,"function":"index","class":"OCA\Bookmarks\Controller\WebViewController","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":127,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OCA\Bookmarks\Controller\WebViewController"},"index"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OCA\Bookmarks\Controller\WebViewController"},"index"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\AppFramework\App","type":"::","args":["OCA\Bookmarks\Controller\WebViewController","index",{"class":"OC\AppFramework\DependencyInjection\DIContainer"},{"_route":"bookmarks.web_view.index"}]},{"file":"/var/www/html/lib/base.php","line":993,"function":"match","class":"OC\Route\Router","type":"->","args":["/apps/bookmarks/"]},{"file":"/var/www/html/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/custom_apps/bookmarks/lib/Db/TreeMapper.php","Line":708},"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:86.0) Gecko/20100101 Firefox/86.0","version":"21.0.0.18"}

Pinaute commented 3 years ago

Hi, I looked at the logs, I have the same error, but for all I know only one user is affected by the bug and not using floccus. I installed the plugin a day ago.

marcelklehr commented 3 years ago

Thanks for reporting! I will look into this soon :)

marcelklehr commented 3 years ago

This looks like the following issue https://github.com/nextcloud/bookmarks/issues/1467

Can you verify this?

TonKkkkk commented 3 years ago

Thanks for the hint, had a look in the referenced issue and used the described database commando's. It looks for me that i do not have the "oc_bookmarks_root_folders" or the "oc_bookmarks_tree" in the database, or I did something wrong in the database commands. So in case the entries are not in the database it could be the same "output" as #1467 but from a different source.

The output of my commands is:

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| nextcloud          |
| performance_schema |
+--------------------+

MariaDB [(none)]> use nextcloud;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

MariaDB [nextcloud]> SELECT * from oc_bookmarks_root_folders WHERE user_id = 'ton';
**ERROR 1146 (42S02): Table 'nextcloud.oc_bookmarks_root_folders' doesn't exist**

MariaDB [nextcloud]> SELECT * from oc_bookmarks_tree;
**ERROR 1146 (42S02): Table 'nextcloud.oc_bookmarks_tree' doesn't exist**
marcelklehr commented 3 years ago

That's suspicious, though. Can you try SHOW TABLES; in the nextcloud database? If there are no bookmarks tables at all in there, then you'd have much more severe errors, I think.

Pinaute commented 3 years ago

@TonKkkkk Try with bookmarks_root_folders instead of oc_bookmarks_root_folders ?

Pinaute commented 3 years ago

With the user impacted by the error, I see two root folders. The other users not impacted by the error have only one root folder.

psql (9.6.1)
Type "help" for help.

nextcloud=# SELECT * from bookmarks_root_folders WHERE user_id = 'eric';
 user_id | folder_id 
---------+-----------
 eric    |         5
 eric    |         6
(2 rows)
marcelklehr commented 3 years ago

@Pinaute Then you can continue as outlined in https://github.com/nextcloud/bookmarks/issues/1467#issuecomment-803676461

I will probably create a repair step for this so, other people don't have to do this manually in the future.

TonKkkkk commented 3 years ago

Yes it looks like the tables are named different, without oc_. Is this OK, where does this different naming come from? Can I then remove one of the folders like in #1467 or do I have another problem due to the different naming?

When I call without oc_ I get two tables :

MariaDB [nextcloud]> SELECT * from bookmarks_root_folders WHERE user_id = 'ton';
+---------+-----------+
| user_id | folder_id |
+---------+-----------+
| ton     |         1 |
| ton     |         2 |
+---------+-----------+
2 rows in set (0.000 sec)

When I print the tables I see the names without oc_ Output :

MariaDB [nextcloud]> SHOW TABLES;
+----------------------------+
| Tables_in_nextcloud        |
+----------------------------+
| accounts                   |
| accounts_data              |
| activity                   |
| activity_mq                |
| addressbookchanges         |
| addressbooks               |
| appconfig                  |
| authtoken                  |
| bookmarks                  |
| bookmarks_folders          |
| bookmarks_folders_public   |
| bookmarks_root_folders     |
| bookmarks_shared_folders   |
| bookmarks_shared_to_shares |
| bookmarks_shares           |
| bookmarks_tags             |
| bookmarks_tree             |
| bruteforce_attempts        |
| calendar_invitations       |
| calendar_reminders         |
| calendar_resources         |
| calendar_resources_md      |
| calendar_rooms             |
| calendar_rooms_md          |
| calendarchanges            |
| calendarobjects            |
| calendarobjects_props      |
| calendars                  |
| calendarsubscriptions      |
| cards                      |
| cards_properties           |
| collres_accesscache        |
| collres_collections        |
| collres_resources          |
| comments                   |
| comments_read_markers      |
| dav_cal_proxy              |
| dav_shares                 |
| deck_assigned_labels       |
| deck_assigned_users        |
| deck_attachment            |
| deck_board_acl             |
| deck_boards                |
| deck_cards                 |
| deck_labels                |
| deck_stacks                |
| direct_edit                |
| directlink                 |
| federated_reshares         |
| file_locks                 |
| filecache                  |
| filecache_extended         |
| files_trash                |
| flow_checks                |
| flow_operations            |
| flow_operations_scope      |
| group_admin                |
| group_user                 |
| groups                     |
| jobs                       |
| login_flow_v2              |
| mail_accounts              |
| mail_aliases               |
| mail_attachments           |
| mail_classifiers           |
| mail_coll_addresses        |
| mail_mailboxes             |
| mail_messages              |
| mail_recipients            |
| mail_trusted_senders       |
| migrations                 |
| mimetypes                  |
| mounts                     |
| notifications              |
| notifications_pushtokens   |
| oauth2_access_tokens       |
| oauth2_clients             |
| preferences                |
| privacy_admins             |
| properties                 |
| recent_contact             |
| schedulingobjects          |
| share                      |
| share_external             |
| storages                   |
| storages_credentials       |
| systemtag                  |
| systemtag_group            |
| systemtag_object_mapping   |
| talk_attendees             |
| talk_bridges               |
| talk_commands              |
| talk_guestnames            |
| talk_internalsignaling     |
| talk_rooms                 |
| talk_sessions              |
| text_documents             |
| text_sessions              |
| text_steps                 |
| trusted_servers            |
| twofactor_backupcodes      |
| twofactor_providers        |
| user_status                |
| user_transfer_owner        |
| users                      |
| vcategory                  |
| vcategory_to_object        |
| webauthn                   |
| whats_new                  |
+----------------------------+
109 rows in set (0.001 sec)
TonKkkkk commented 3 years ago

When I look in the folders, both are empty...

MariaDB [nextcloud]> SELECT * from bookmarks_root_folders WHERE user_id = 'ton';
+---------+-----------+
| user_id | folder_id |
+---------+-----------+
| ton     |         1 |
| ton     |         2 |
+---------+-----------+
2 rows in set (0.000 sec)
MariaDB [nextcloud]> SELECT * from bookmarks_tree WHERE parent_folder = 1;
Empty set (0.001 sec)

MariaDB [nextcloud]> SELECT * from bookmarks_tree WHERE parent_folder = 2;
Empty set (0.000 sec)
Pinaute commented 3 years ago

Can I then remove one of the folders like in #1467 or do I have another problem due to the different naming?

I remove one of the folders and it works, no more blue page. You can run the command :

DELETE from bookmarks_root_folders WHERE user_id='ton' and folder_id=1;
Pinaute commented 3 years ago

Is this OK, where does this different naming come from?

I think so, this is normal. The prefix has been removed here https://github.com/nextcloud/server/pull/21112/files

TonKkkkk commented 3 years ago

Thank you very much for the your support :1st_place_medal: This did the trick, works now as expected, see my bookmarks and are able to sync with Floccus

marcelklehr commented 3 years ago

Cool! I'm glad it works now :)

Closing this as a duplicate of #1467