floccus icon indicating copy to clipboard operation
floccus copied to clipboard

[Bug] [v3] JSON.parse: unexpected character at line 1 column 1 of the JSON data

Open Crow-Control opened this issue 6 years ago • 16 comments

Describe the bug When syncing using Nextcloud-Folders (non-legacy) it throws the following error: JSON.parse: unexpected character at line 1 column 1 of the JSON data

To Reproduce Steps to reproduce the behavior:

  1. Install latest on firefox.
  2. Try syncing 200 bookmarks multiple layers of subfolders.
  3. Get error

Expected behavior Should, you know, work and such.

Desktop (please complete the following information):

  • OS: Windows
  • Browser Firefox
  • Browser Version Latest, esr, dev etc
  • Floccus version: v3 (latest)
  • Floccus sync method: nextcloud folders

Server (please complete the following information):

  • OS: FreeBSD
  • Nextcloud version: 7.0.3
  • Bookmarks app version: Latest

Note: Please write down the actual version numbers instead of writing 'latest'.

Debug log

2020-02-02T20:00:38.464Z (nextcloud-folders)CREATE     - #undefined[Shakira - Whenever, Wherever - YouTube](https://www.youtube.com/watch?v=weRHyjj34ZE) parentId: 55
2020-02-02T20:00:39.287Z COMPARE { localItem:   - #PTfKYaTuNT9-[Over the Misty Mountains Cold | The Mary Sue](http://www.themarysue.com/song-from-the-hobbit-trailer/) parentId: kK5AaWRa_wGI,
  cacheItem: undefined,
  serverItem: undefined }
2020-02-02T20:00:39.288Z (nextcloud-folders)CREATE     - #undefined[Over the Misty Mountains Cold | The Mary Sue](http://www.themarysue.com/song-from-the-hobbit-trailer/) parentId: 55
2020-02-02T20:00:40.344Z Syncing failed with E020: Could not parse server response. Is the bookmarks app installed on your server?
JSON.parse: unexpected character at line 1 column 1 of the JSON data
E020: Could not parse server response. Is the bookmarks app installed on your server?
JSON.parse: unexpected character at line 1 column 1 of the JSON data
E020: Could not parse server response. Is the bookmarks app installed on your server?
JSON.parse: unexpected character at line 1 column 1 of the JSON data
  • [x] Debug log provided

Additional context Also happens on V4 (when not running it on root, see #444 ). Legacy sync works fine (as far as one could call that "fine".

Crow-Control avatar Feb 02 '20 20:02 Crow-Control

Nextcloud version 7.0.3

Floccus doesn't support this version of nextcloud. In any case, it would be helpful to know the actual version of your bookmarks app install, as the latest available version varies across nextcloud versions.

marcelklehr avatar Feb 11 '20 13:02 marcelklehr

Floccus doesn't support this version of nextcloud

is there any documentation what is and isn't supported?

Crow-Control avatar Feb 11 '20 14:02 Crow-Control

The addon pages cite nextcloud bookmarks v0.11 or greater. ~~However, when using the nextcloud-folders sync methods, v1.x or greater is supported (this is not documented indeed).~~ Any nextcloud versions that these app versions support is implicitly supported. Nextcloud 7.x is very old.

Update: The add-account screen in the addon itself actually declares the dependencies:

The option 'Nextcloud Bookmarks' is compatible with at least version v0.14 of the Bookmarks app.

marcelklehr avatar Feb 11 '20 18:02 marcelklehr

Shoot, Thats a typo from my side: Its: 17.0.3

Crow-Control avatar Feb 11 '20 19:02 Crow-Control

I see. It would be interesting to know, which endpoint is responsible for that non-json output, and what the actual response is. Do you think you can find out? (about:debugging and then inspect thte network tab of the addon)

marcelklehr avatar Feb 12 '20 11:02 marcelklehr

The same error occured at my instance. I used this howto: https://decatec.de/home-server/nextcloud-lesezeichen-synchronisieren-mit-chrome-firefox/

The error occured because I used the wrong server-path mentioned in the howto. false: https://mydomain.de/nextcloud correct: https://mydomain.de

After correcting the path everything worked alright.

funkmastergst avatar Apr 10 '20 18:04 funkmastergst

@funkmastergst That wasn't the case with my issue sadly enough.

Crow-Control avatar Apr 11 '20 08:04 Crow-Control

@Ornias1993 Did you get it sorted out?

marcelklehr avatar Apr 11 '20 21:04 marcelklehr

I'm having the same problem. I debugged the sync via about:debugging and noticed that I kept getting redirected to the login page, even though I was already logged in:

https://mydomain.de/index.php/apps/bookmarks/public/rest/v2/folder/-1/hash:

HTTP/1.1 302 Found
Server: nginx/1.14.2
Date: Sun, 12 Apr 2020 17:46:22 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 0
Connection: keep-alive
Referrer-Policy: no-referrer
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-Robots-Tag: none
X-XSS-Protection: 1; mode=block
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache

...

Location: https://mydomain.de/index.php/login?noredir=1

I don't know about the others, but in my case it seems to be a problem with the openid-connect plugin I'm using (https://github.com/pulsejet/nextcloud-oidc-login). Once I deactivated it, it worked.

Schlecki avatar Apr 12 '20 18:04 Schlecki

@Ornias1993 Did you get it sorted out?

As I didn't get any support from you on this issue, I stopped using this extention completely.

Crow-Control avatar Apr 14 '20 08:04 Crow-Control

I see. I did offer a way to find out more about the problem. Unless you want to investigate further, I'll close this.

marcelklehr avatar Apr 14 '20 10:04 marcelklehr

@Ornias1993 Did you get it sorted out?

As I didn't get any support from you on this issue, I stopped using this extention completely.

Hi marcelklehr, I had the same issue. In order to fix it, try not using your Nextcloud password. Instead, create a new app password:

  1. In your Nextcloud account, please go to Settings -> Personal -> Security -> Devices & sessions
  2. Enter any "App name", e.g. "Floccus on Ubuntu"
  3. Copy the password and use it in Floccus

Hopefully, it will help. Cheers.

albert-gee avatar Aug 02 '20 00:08 albert-gee

I see. It would be interesting to know, which endpoint is responsible for that non-json output, and what the actual response is. Do you think you can find out? (about:debugging and then inspect thte network tab of the addon)

Hey @marcelklehr. I had the same issue and started to debug the problem. In netwerk view I found some errors which were related with the creation of new Bookmarks (PUT). Though not all bookmarks had problems I investigated the ones who had. My solution was the title length of the bookmarks. By shrinking it down (the bookmark itself) the sync worked.

Hope that can help you either by fixing the length or thowing a better error message.

JoergOswald avatar Jan 01 '21 15:01 JoergOswald

Although this has been closed for almost a year, I'd like to comment that I keep getting the error message from the Issue's title every couple of seconds. I.e., Floccus tries to sync, fails, tries, fails, etc. For the sheer number of bookmarks (I've kept moving them along as old devices went and new devices came since around 1999) what @JoergOswald did isn't an option to me.

sixtyfive avatar Feb 19 '21 10:02 sixtyfive

@sixtyfive You could still investigate what causes the error. Failed JSON parse may happen because of bookmarks not being installed on nextcloud, or a server-side error. Checking the nextcloud log for errors would yield more information. I encourage you to open a new issue for this, though.

marcelklehr avatar Feb 19 '21 10:02 marcelklehr

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Mar 21 '23 00:03 github-actions[bot]