CarnetApp / CarnetNextcloud

GNU Affero General Public License v3.0
153 stars 28 forks source link

Nextcloud frontend interface cannot save and produces errors #191

Closed weierophinney closed 1 year ago

weierophinney commented 1 year ago

I have just installed Carnet on my Nextcloud instance. I am able to create a new item and give it a title, but the following happens:

When I go to my Nextcloud logs, I get a message indicating Undefined array key "text" at /var/snap/nextcloud/31222/nextcloud/extra-apps/carnet/lib/Hooks/FSHooks.php#85.

Interestingly, I can use the Android application, and notes are created successfully from there, and I can view them within the Nextcloud Carnet application; I just cannot edit them from there.

To Reproduce Steps to reproduce the behavior:

  1. Install Carnet in Nextcloud.
  2. Navigate to Carnet in your Nextcloud instance, via your web browser.
  3. Click the "+" button to create a new note.
  4. Give the note a title.
  5. Provide contents for the note (text, a checklist, media, etc.)

At this point, I receive notification of the error, and any work I have done, other than providing the title, is lost.

(One point of clarification: adding keywords does work. This seems restricted to the note contents.)

Expected behavior The note should save with all contents, without error.

Log entry The following is a sample log entry:

{"reqId":"7iDqtHFblFFz8kURba9t","level":3,"time":"2022-08-02T19:03:08+00:00","remoteAddr":"208.107.9.34","user":"matthew","app":"PHP","method":"POST","url":"/index.php/apps/carnet/notes/move","message":"Undefined array key \"text\" at /var/snap/nextcloud/31222/nextcloud/extra-apps/carnet/lib/Hooks/FSHooks.php#85","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36","version":"24.0.3.2","exception":{"Exception":"Error","Message":"Undefined array key \"text\" at /var/snap/nextcloud/31222/nextcloud/extra-apps/carnet/lib/Hooks/FSHooks.php#85","Code":0,"Trace":[{"file":"/var/snap/nextcloud/31222/nextcloud/extra-apps/carnet/lib/Hooks/FSHooks.php","line":85,"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/snap/nextcloud/31222/nextcloud/extra-apps/carnet/appinfo/app.php","line":43,"function":"postWrite","class":"OCA\\Carnet\\Hooks\\FSHooks","type":"->"},{"function":"OCA\\Carnet\\AppInfo\\{closure}","class":"OCA\\Carnet\\AppInfo\\Application","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Hooks/EmitterTrait.php","line":106,"function":"call_user_func_array"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Hooks/PublicEmitter.php","line":40,"function":"emit","class":"OC\\Hooks\\BasicEmitter","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Files/Node/Root.php","line":143,"function":"emit","class":"OC\\Hooks\\PublicEmitter","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Files/Node/Node.php","line":117,"function":"emit","class":"OC\\Files\\Node\\Root","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Files/Node/Node.php","line":444,"function":"sendHooks","class":"OC\\Files\\Node\\Node","type":"->"},{"file":"/var/snap/nextcloud/31222/nextcloud/extra-apps/carnet/lib/Controller/NoteController.php","line":713,"function":"move","class":"OC\\Files\\Node\\Node","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"moveNote","class":"OCA\\Carnet\\Controller\\NoteController","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/snap/nextcloud/31222/htdocs/lib/base.php","line":1023,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/snap/nextcloud/31222/htdocs/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"id":"62e9752654ec2"}

Desktop (please complete the following information):

Smartphone (please complete the following information):

Nextcloud information:

weierophinney commented 1 year ago

After applying the patch from #192, I encountered additional issues.

First, when creating a new note, I get the same error message as previously reported, but this tiem against lib/Controller/NoteController.php line 646. I am amending the patch in #192 to fix this as well, but it doesn't fully resolve the issues.

Next, when trying to edit an existing note, I received the following:

{"reqId":"bZPBoAl1lmSaDwRx7vSY","level":3,"time":"2022-08-03T19:47:32+00:00","remoteAddr":"208.107.9.34","user":"matthew","app":"index","method":"POST","url":"/index.php/apps/carnet/note/saveText","message":"\".carnet/cache/matthew/currentnote62ead0c62413f/metadata.json\" is locked, existing lock on file: 2 shared locks","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36","version":"24.0.3.2","exception":{"Exception":"OCP\\Lock\\LockedException","Message":"\".carnet/cache/matthew/currentnote62ead0c62413f/metadata.json\" is locked, existing lock on file: 2 shared locks","Code":0,"Trace":[{"file":"/snap/nextcloud/31222/htdocs/lib/private/Files/View.php","line":1166,"function":"changeLock","class":"OC\\Files\\View","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Files/View.php","line":711,"function":"basicOperation","class":"OC\\Files\\View","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Files/Node/File.php","line":71,"function":"file_put_contents","class":"OC\\Files\\View","type":"->"},{"file":"/var/snap/nextcloud/31222/nextcloud/extra-apps/carnet/lib/Controller/NoteController.php","line":753,"function":"putContent","class":"OC\\Files\\Node\\File","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"saveTextToOpenNote","class":"OCA\\Carnet\\Controller\\NoteController","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/snap/nextcloud/31222/htdocs/lib/base.php","line":1023,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/snap/nextcloud/31222/htdocs/lib/private/Files/View.php","Line":2009,"Previous":{"Exception":"OCP\\Lock\\LockedException","Message":"\"files/d90e603c2f1697a7d27ae61e3270af83\" is locked, existing lock on file: 2 shared locks","Code":0,"Trace":[{"file":"/snap/nextcloud/31222/htdocs/lib/private/Files/Storage/Common.php","line":822,"function":"changeLock","class":"OC\\Lock\\MemcacheLockingProvider","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Files/Storage/Wrapper/Wrapper.php","line":632,"function":"changeLock","class":"OC\\Files\\Storage\\Common","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Files/Storage/Wrapper/Wrapper.php","line":632,"function":"changeLock","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Files/View.php","line":2003,"function":"changeLock","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Files/View.php","line":1166,"function":"changeLock","class":"OC\\Files\\View","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Files/View.php","line":711,"function":"basicOperation","class":"OC\\Files\\View","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Files/Node/File.php","line":71,"function":"file_put_contents","class":"OC\\Files\\View","type":"->"},{"file":"/var/snap/nextcloud/31222/nextcloud/extra-apps/carnet/lib/Controller/NoteController.php","line":753,"function":"putContent","class":"OC\\Files\\Node\\File","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"saveTextToOpenNote","class":"OCA\\Carnet\\Controller\\NoteController","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/snap/nextcloud/31222/htdocs/lib/base.php","line":1023,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/snap/nextcloud/31222/htdocs/lib/private/Lock/MemcacheLockingProvider.php","Line":138},"CustomMessage":"--"},"id":"62ead0e6f2ebd"}

Relevant part:

".carnet/cache/matthew/currentnote62ead0c62413f/metadata.json" is locked, existing lock on file: 2 shared locks

I'm not sure how to resolve this.

weierophinney commented 1 year ago

Another piece of information about my setup that may be causing issues: I use S3-compatible storage instead of the filesystem. I'm seeing errors saving information that stem from OCA\Carnet\Controller\NoteController->saveTextToOpenNote().