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

Error when opening Notes App page #886

Closed
gcala opened this issue Jul 23, 2022 · 18 comments
Closed

Error when opening Notes App page #886

gcala opened this issue Jul 23, 2022 · 18 comments
Labels
bug Something isn't working help wanted Complex issue or we don't know how to fix it

Comments

@gcala
Copy link

gcala commented Jul 23, 2022

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 gcala added bug Something isn't working need to reproduce Issue that has not been reproduced labels Jul 23, 2022
@korelstar
Copy link
Member

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).

@rgacogne
Copy link

rgacogne commented Aug 1, 2022

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 :-/

@korelstar
Copy link
Member

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 ] ).

@rgacogne
Copy link

rgacogne commented Aug 3, 2022

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.

@bolderbast
Copy link

bolderbast commented Aug 10, 2022

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
Copy link

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 ?!?

@fvdnabee
Copy link

fvdnabee commented Aug 12, 2022

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
Copy link

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?

@korelstar
Copy link
Member

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 korelstar removed the need to reproduce Issue that has not been reproduced label Aug 13, 2022
@korelstar
Copy link
Member

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

@rgacogne
Copy link

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
Copy link

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

korelstar added a commit that referenced this issue Sep 4, 2022
@korelstar korelstar mentioned this issue Sep 4, 2022
korelstar added a commit that referenced this issue Sep 4, 2022
korelstar added a commit that referenced this issue Sep 4, 2022
@korelstar
Copy link
Member

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 #886 (comment)). 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 korelstar added the help wanted Complex issue or we don't know how to fix it label Sep 4, 2022
@cyberic99
Copy link

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.

@gcala
Copy link
Author

gcala commented Sep 18, 2022

@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 ❤️

@cyberic99
Copy link

hey, cool, I m glad I could help !

@rgacogne
Copy link

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

@korelstar
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Complex issue or we don't know how to fix it
Projects
None yet
Development

No branches or pull requests

6 participants