notes icon indicating copy to clipboard operation
notes copied to clipboard

Error when opening Notes App page

Open gcala opened this issue 3 years ago • 17 comments

It's a couple of months that Notes App in browser is showing a generic error saying "Fetching notes has failed. See JavaScript console and server log for details."

In the console I found a bunch of:

NotesService.js:92 TypeError: e is not iterable
    at updateNotes (notes.js:130)
    at Array.<anonymous> (vuex.esm.js:851)
    at u.dispatch (vuex.esm.js:516)
    at u.dispatch (vuex.esm.js:406)
    at NotesService.js:77

I tried Firefox, Brave, Chrome and Falkon too, with and without adblock addons, no luck.

I have no problem from my android app.

Steps to reproduce

  1. Open Notes App page

Expected behaviour

List of my notes

Actual behaviour

Blank page with errors

Screenshots

notes_app

Server

  • Notes app version: 4.4.0
  • Nextcloud version: 24.0.3
  • OS: Linux 5.15.54-1-lts
  • Web server: apache 2.4.54
  • PHP version: php7 7.4.30
  • Database: mariadb 10.8.3

Nextcloud configuration:

``` { "system": { "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "***REMOVED SENSITIVE VALUE***", "***REMOVED SENSITIVE VALUE***", ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "dbtype": "mysql", "version": "24.0.3.2", "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***", "htaccess.RewriteBase": "\/", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbport": "", "dbtableprefix": "oc_", "mysql.utf8mb4": true, "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "memcache.local": "\\OC\\Memcache\\APCu", "theme": "", "loglevel": 2, "maintenance": false, "default_phone_region": "IT", "activity_expire_days": 90, "twofactor_enforced": "true", "apps_paths": [ { "path": "\/usr\/share\/webapps\/nextcloud\/apps", "url": "\/apps", "writable": false }, { "path": "\/var\/lib\/nextcloud\/apps", "url": "\/wapps", "writable": true } ], "twofactor_enforced_groups": [], "twofactor_enforced_excluded_groups": [ "guests", "sancarlo" ], "app_install_overwrite": [ "calendar", "files_reader", "news", "maps", "contacts", "social", "spreed", "twofactor_nextcloud_notification", "phonetrack", "twofactor_admin" ], "has_rebuilt_cache": true } } ```

Client

  • Browser (incl. version): Firefox 102.0.1, Chrome 103.0.5060.53, Falkon 22.04.3
  • OS: Arch Linux

gcala avatar Jul 23 '22 10:07 gcala

Hmm, that's strange. Until now, you're the only person with this problem. You are saying that this error happens since a couple of months. Do you have an idea, what may have changed at that point? Was it a Nextcloud (server or notes app) update? If yes: please restart your apache httpd server, sometimes the server caches some files.

Does the server log contains any errors?

Could you please check the Network-tab of your browser console? There should be a request to .../apps/notes/notes. I'm interested in the response code (is it 200?) and the content (please remove personal data).

korelstar avatar Aug 01 '22 14:08 korelstar

I actually have the same issue since (I believe) upgrading to 24.0. Firefox tells me:

TypeError: e is undefined
    i notes-main.js:1
    updateNotes notes.js:130
    h vuex.esm.js:851
    dispatch vuex.esm.js:516
    dispatch vuex.esm.js:406
    g NotesService.js:77
[NotesService.js:92:12](webpack:///src/NotesService.js)
    g NotesService.js:92

Chromium:

TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at i (notes-main.js?v=329c6968-0:1:54679)
    at u.updateNotes (notes.js:127:30)
    at Array.<anonymous> (vuex.esm.js:851:23)
    at u.dispatch (vuex.esm.js:516:13)
    at u.dispatch (vuex.esm.js:406:21)
    at NotesService.js:77:11
(anonymous) @ NotesService.js:92

I also use Arch, but nginx+php-fpm instead of apache, and the whole server has been restarted several times since. The Android application works fine, for what it is worth.

I have no error in my logs, all HTTP responses in the network tab have a 200 status, including the one to apps/notes/notes. The response content is valid JSON, but it's hard to provide anything interesting while keeping the personal information out :-/

rgacogne avatar Aug 01 '22 15:08 rgacogne

Hmmm, interesting. :-/

The response content is valid JSON, but it's hard to provide anything interesting while keeping the personal information out :-/

The response should have this structure:

{
"notesData": [
	{ "id":123456, "title":"Note title", "modified":1355853787, "category":"Category1", "favorite":false, "readonly":false, "error":false, "errorType":"", "etag":"ca28268242b6ad1ab9db7eb739792a7c" },
	...
],
"noteIds": [ 123456, ... ],
"categories": [ "Category1", ... ],
"settings": { "notesPath": "Notizen", "fileSuffix": ".md", "noteMode": "edit", "customSuffix": ".txt" },
"lastViewedNote": 123456,
"errorMessage": null
}

Could you please check if your response content does look similar? Especially, I would like to know if the notesData and noteIds lists are non-empty arrays (i.e. they have those brackets [ and ] ).

korelstar avatar Aug 03 '22 06:08 korelstar

It does look correct:

{"notesData":[{"id":220,"title":"Note1","modified":1649179676,"category":"","favorite":false,"readonly":false,"error":false,"errorType":"","etag":"6feee4c33d5fad6f33d9342768e9b40d"}, [...]],
"noteIds":[43407,45640,12810,45156,44002,39379,25913,26707,50060,31437,50310,3075,37092,12842,2780,31146,36157,44810,36998,31645,33145,41270,50206,43529,35747,220,28110,37160,2998,40446,23899,45961,15748,12859,38316,42682,24421,10472,2635,42716,3204,38322,31015,3063,43147,14149,45250,2755,20065,49102],
"categories":[],
"settings":{"notesPath":"Notes","fileSuffix":".txt","noteMode":"edit","customSuffix":".txt"},
"lastViewedNote":45961,
"errorMessage":null}

I have more entries in notesData, as you can tell by the entries in noteIds, I just redacted most of them.

rgacogne avatar Aug 03 '22 12:08 rgacogne

I have the same error after upgrading from Nextcloud 23.x to 24.0.3 (along with a full system update). Figured I'd remove and reinstall the Notes app from the GUI. It seems to first install 4.0.4, and then tries to update to 4.4.0? This fails with:

App "Notes" cannot be installed because the following dependencies are not fulfilled: PHP with a version lower than 8.0 is required. Server version 22 or lower is required.

Manually extracting the notes.tar.gz file in the webapps/nextcloud/apps directory installs the app again, but the original error is back as well...

What info can I provide to help resolve this issue?

I have a similar setup as @rgacogne (Arch Linux with Nginx)

bolderbast avatar Aug 10 '22 13:08 bolderbast

OK, this is weird. After the steps outlined above, I don't think I did any changes. However, today suddenly the Notes application loads without errors. I did reboot my workstation, could that have resolved it ?!?

bolderbast avatar Aug 11 '22 12:08 bolderbast

image

Same issue with Notes 4.4.0 on nextcloud 24.0.3 in Firefox and Chromium. The /apps/notes/notes request's response code is 200 and the body appears to be valid JSON (with notesData and noteIds that is filled in). Nextcloud is hosted on arch linux.

I don't find anything suspicious in the response. noteIds is not in the same order as notesData; but that is expected I take it? Redacted screenshot of the notes response below: image

fvdnabee avatar Aug 12 '22 07:08 fvdnabee

I installed the notes app in dev mode and after applying the following change, my browser doesn't throw the error anymore. Even when I undo the change, the error doesn't return.

diff --git a/src/store/notes.js b/src/store/notes.js
index 2f9d7da2..e9d98d3c 100644
--- a/src/store/notes.js
+++ b/src/store/notes.js
@@ -116,6 +116,9 @@ const mutations = {
 const actions = {
        updateNotes(context, { noteIds, notes }) {
                // add/update new notes
+               if (!notes || !noteIds) {
+                       return
+               }
                for (const note of notes) {
                        // TODO check for parallel (local) changes!
                        context.commit('updateNote', note)

Btw I couldn't get source maps to work in Firefox and chromium, so finding the origin of the error was a PITA. Are source maps working and if not: how would you debug something like this?

fvdnabee avatar Aug 12 '22 08:08 fvdnabee

Hey @fvdnabee , thanks for your investigations! Together with @bolderbast 's experience, I think there is a caching problem somewhere. However, I have no idea where it is. Nevertheless, I will add another check for undefined. Let's see, if this helps.

Btw I couldn't get source maps to work in Firefox and chromium, so finding the origin of the error was a PITA. Are source maps working and if not: how would you debug something like this?

I'm observing issues with the source maps, too. It looks like the line references in the error console are not correct. After some searching, this could be because we use babel together with webpack. The Notes app is using Nextcloud's webpack config. I think this problem has to be fixed over there. Do you have an idea how to fix it? A PR is always welcome!

korelstar avatar Aug 13 '22 15:08 korelstar

I just released Notes v4.5.0. Please check, if the issue still exists.

korelstar avatar Aug 14 '22 09:08 korelstar

I upgraded Nextcloud to 24.0.4 and Notes to 4.5.0, rebooted the server for good measure but I still have the issue :-/ Is there anything else I can do to help pinpoint the issue?

rgacogne avatar Aug 15 '22 19:08 rgacogne

For what it is worth, a different user on my instance with no notes also gets the same error.

rgacogne avatar Aug 16 '22 16:08 rgacogne

Since I still have no idea on fixing this, I just released Notes version 4.5.1 which includes some more debug output (based on https://github.com/nextcloud/notes/issues/886#issuecomment-1212847390). Please update to this version and try again. Please have a look at your browser's JavaScript console and search for the string This should not happen, please see issue #886. Please give feedback if it appears and paste the following lines (including the stack trace).

korelstar avatar Sep 04 '22 09:09 korelstar

Same error for me, since I upgraded to Nextcloud 24.0.5. (from v23.x), on archlinux. Notes version 4.5.1

But I managed to fix it.

In fact, I had several 'app_paths' in my config, one of them being writable, and the other, not.

The first one, not writable, had still an old version of notes (3.6.1 if I recall correctly), so maybe it created a conflict...

I removed the folder in the first app_path, then I unstalled notes with occ:app remove notes BACLUP YOUR NOTES BEFORE DOING THAT, then reinstalled notes with occ, and now it works beautifully.

My problem might not be related, but I was getting exactly the same error, so some users might have the same 'broken' setup as me.

Before that, I also tried to empty the whole notes folder, but I still had the error.

cyberic99 avatar Sep 16 '22 22:09 cyberic99

@cyberic99 What a wonderful trick!! I first tried it with notes app and worked great, then I did the same for news and contacts apps and solved all issues! Thank you :heart:

gcala avatar Sep 18 '22 12:09 gcala

hey, cool, I m glad I could help !

cyberic99 avatar Sep 18 '22 13:09 cyberic99

I can confirm that removing the folder in the first app_path solved the issue for me as well, thanks a lot!

rgacogne avatar Sep 18 '22 15:09 rgacogne

It looks that this issue cannot be fixed within the Notes app and there is a workaround for it. Therefore, I'll close this issue.

korelstar avatar Oct 01 '22 15:10 korelstar