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

PATCH Method returned Bad request 400 error #998

Closed
armadillo11 opened this issue May 1, 2020 · 8 comments
Closed

PATCH Method returned Bad request 400 error #998

armadillo11 opened this issue May 1, 2020 · 8 comments
Labels
Projects

Comments

@armadillo11
Copy link

Describe the bug
After upgrading to 3.0.0 until 3.0.3 I get a PATCH method error 400 "Bad request" at the end of the sync.

To Reproduce

  1. Due to an upgrade error from 2.x to 3.0.0 I deleted all oc_bookmark tables on server side
  2. saved me bookmarks locally with firefox 75
  3. syncronized an empty bookmarks folder
  4. Restored all my bookmarks again within Firefox
  5. synced with NC bookmarks and then at the end I get the 400 Bad Request error of the PATCH method.

Expected behavior
Syncronization ends without an error

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Linux
  • Browser Firefox with floccus
  • Version 75

Server (please complete the following information):

  • OS: Debian 9.12
  • HTTP server: Apache/2.4.25 (Debian)
  • Database: mysqld 10.1.44-MariaDB-0+deb9u1
  • PHP version: PHP 7.3.14-5+020200202.52+debian91.gbpa71879
  • Nextcloud version: 18.0.4.2
  • Bookmarks app version: 3.0.3
  • Activated Nextcloud Apps: [the output of running $ sudo -u www-data php occ app:list in your command line]
Enabled:
  - accessibility: 1.4.0
  - activity: 2.11.0
  - apporder: 0.9.0
  - audioplayer: 2.10.0
  - bookmarks: 3.0.3
  - calendar: 2.0.3
  - cloud_federation_api: 1.1.0
  - cms_pico: 1.0.5
  - comments: 1.8.0
  - contacts: 3.3.0
  - dav: 1.14.0
  - federatedfilesharing: 1.8.0
  - federation: 1.8.0
  - files: 1.13.1
  - files_markdown: 2.2.0
  - files_pdfviewer: 1.7.0
  - files_rightclick: 0.15.2
  - files_sharing: 1.10.1
  - files_trashbin: 1.8.0
  - files_versions: 1.11.0
  - files_videoplayer: 1.7.0
  - firstrunwizard: 2.7.0
  - logreader: 2.3.0
  - lookup_server_connector: 1.6.0
  - nextcloud_announcements: 1.7.0
  - notes: 3.2.0
  - notifications: 2.6.0
  - oauth2: 1.6.0
  - password_policy: 1.8.0
  - passwords: 2020.4.1
  - photos: 1.0.0
  - privacy: 1.2.0
  - provisioning_api: 1.8.0
  - recommendations: 0.6.0
  - serverinfo: 1.8.0
  - settings: 1.0.0
  - sharebymail: 1.8.0
  - spreed: 8.0.8
  - support: 1.1.0
  - survey_client: 1.6.0
  - systemtags: 1.8.0
  - tasks: 0.12.2
  - text: 2.0.0
  - theming: 1.9.0
  - twofactor_backupcodes: 1.7.0
  - updatenotification: 1.8.0
  - viewer: 1.2.0
  - workflowengine: 2.0.0
  • Nextcloud configuration: [the output of running sudo -u www-data php occ config:list system]
{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "xxx.de"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/xxx.de",
        "dbtype": "mysql",
        "version": "18.0.4.2",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "UTC",
        "installed": true,
        "mail_smtpmode": "smtp",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpsecure": "ssl",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "loglevel": 0,
        "maintenance": false,
        "theme": "",
        "updater.release.channel": "stable",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "overwritehost": "xxx.de",
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "app_install_overwrite": [
            "calendar",
            "spreed"
        ]
    }
}
  • Nextcloud external user backend: [e.g. ldap, or none]

Additional context
Add any other context about the problem here.

Web server error log

xxx.xxx.xxx.xxx - stefan [01/May/2020:07:42:46 +0000] "PATCH /index.php/apps/bookmarks/public/rest/v2/folder/-1/childorder HTTP/1.1" 400 1647 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0"
xxx.xxx.xxx.xxx - stefan [01/May/2020:07:43:46 +0000] "PATCH /index.php/apps/bookmarks/public/rest/v2/folder/-1/childorder HTTP/1.1" 400 1635 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0"
xxx.xxx.xxx.xxx - stefan [01/May/2020:07:44:47 +0000] "PATCH /index.php/apps/bookmarks/public/rest/v2/folder/-1/childorder HTTP/1.1" 400 1637 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0"

Nextcloud log (nextcloud/data/nextcloud.log)

{"reqId":"96oZxpMRDktqfxgypXPt","level":0,"time":"2020-05-01T07:15:03+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Finished OCA\\Bookmarks\\BackgroundJobs\\PreviewsJob job with ID 77 in 0 seconds","userAgent":"--","version":"18.0.4.2"}
{"reqId":"wQYfTcnnr2RRLxsKpcDW","level":0,"time":"2020-05-01T07:45:03+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Run OCA\\Bookmarks\\BackgroundJobs\\PreviewsJob job with ID 77","userAgent":"--","version":"18.0.4.2"}
{"reqId":"wQYfTcnnr2RRLxsKpcDW","level":0,"time":"2020-05-01T07:45:03+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Finished OCA\\Bookmarks\\BackgroundJobs\\PreviewsJob job with ID 77 in 0 seconds","userAgent":"--","version":"18.0.4.2"}

Browser log

Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log 
c) ...
@armadillo11 armadillo11 added the bug label May 1, 2020
@armadillo11
Copy link
Author

Here a small screenshot showing the error in Firefox...
NC_Bookmarks_Patch_error

@marcelklehr
Copy link
Member

Mmh. Could you find out the error message that the endpoint returns? (By debugging floccus)

Firefox

  • Go to about:debugging
  • enable debugging
  • click on debug button next to floccus entry and change to the network tab
  • go to floccus options and make sure the account of your choice is connected
  • trigger a sync by clicking on sync now for the account of your choice.
  • go back to the network inspector and check the response for the PATCH request

Chrome

  • Go to chrome://extensions
  • enable Developer mode
  • click on dist/html/background.html button in floccus' entry next to "Inspect views: " and go to the network tab in the newly opened inspector window
  • go to floccus options and make sure the account of your choice is connected
  • trigger a sync by clicking on Sync now for the account of your choice
  • go back to the network inspector and check the response for the PATCH request

@armadillo11
Copy link
Author

Okay. Here it is: {"status":"error","data":"invalid children order: To many children"}

And here are the parameter:
{"data":[{"id":"2","type":"folder"},{"id":"2","type":"folder"},{"id":"3","type":"folder"},{"id":"5","type":"folder"},{"id":"5","type":"folder"},{"id":"31","type":"folder"},{"id":"32","type":"folder"},{"id":"33","type":"folder"},{"id":"4","type":"folder"},{"id":"4","type":"folder"},{"id":"47","type":"folder"},{"id":"46","type":"folder"},{"id":"45","type":"folder"},{"id":"50","type":"folder"},{"id":"56","type":"folder"},{"id":"57","type":"folder"},{"id":"280","type":"bookmark"},{"id":"59","type":"folder"},{"id":"62","type":"folder"},{"id":"58","type":"folder"},{"id":"61","type":"folder"},{"id":"3","type":"folder"},{"id":"31","type":"folder"},{"id":"32","type":"folder"},{"id":"33","type":"folder"},{"id":"47","type":"folder"},{"id":"280","type":"bookmark"},{"id":"46","type":"folder"},{"id":"45","type":"folder"},{"id":"50","type":"folder"},{"id":"56","type":"folder"},{"id":"57","type":"folder"},{"id":"58","type":"folder"},{"id":"59","type":"folder"},{"id":"61","type":"folder"},{"id":"62","type":"folder"}]}

@marcelklehr
Copy link
Member

This is probably fixed with v3.0.4 of the bookmarks app.

@armadillo11
Copy link
Author

No, the problem still exists... Just tested with 3.0.4... Now I get 2 PATCH 400 Bad requests at the end of the sync with the same "invalid children order: to many children" error...

@marcelklehr
Copy link
Member

Indeed, this appears to be a problem with floccus.

{
      "id": "2",
      "type": "folder"
    },
    {
      "id": "2",
      "type": "folder"
    },

The data sent to the server shows the same folder twice. I will look into this.

@marcelklehr
Copy link
Member

Perhaps, it's not, though. Does this still happen with the latest bookmarks app version?

@marcelklehr marcelklehr added this to In Progress in Bookmarks May 9, 2020
@armadillo11
Copy link
Author

Hi Marcel,

with current version it works. But in the meantime I checked that all bookmarks were transferred to the server and synchronized correctly within another Firefox installation on another computer. After that I deleted all entries on the Firefox installation where this error occurred and re-synchronized it again. After this step it worked fine!

Regards,
Stefan

Bookmarks automation moved this from In Progress to Done May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

2 participants