fr0tt / benotes

An open source self hosted notes and bookmarks taking web app.
https://benotes.org
MIT License
746 stars 48 forks source link

Data not being saved #73

Closed Bag72 closed 1 year ago

Bag72 commented 1 year ago

I've just started with Benotes and I'm impressed with the I/F. Simple and easy to use. I've been using it OK for about a week. I like it a lot.

However, yesterday I had some data that was not saved. I noticed a little box in the bottom left which said there was an error. I almost missed it. Could it be moved centre screen or up by the Save button to make it more obvious. As pressing save closes the page, and remember there was an error, I lost my input. I then started copying the page before saving just in case and it happened a few times.

Then I found a record that had not given an error message but hadn't saved the data. I edited it again thinking that I hadn't saved it and it closed but didn't save. No error messages at all. I could make some changes and it would be saved but others wouldn't be saved. All failed saves did not give any errors at all. Obviously I have no idea how long this has been happening it could have been from day 0.

Anyone have an ideas on how I can fix this or diagnose the issue.

I am on a QNAP NAS running the latest QTS Hero. The App is in a Docker Container and set up on NGinx. Access works fine and everything appears OK. Only issues are the occasional error failing to save and it simply not saving with no errors.

fr0tt commented 1 year ago

Interesting. Thanks for writing. Seems like a good idea to only navigate back if there was no error. (Initially I wanted to redirect before that could be checked in order to offer a better/smoother performance.)

Can you reproduce it ? Does it only happen with certain posts ? Or after a certain amount of time ? Any errors you can find in your browser's console or in /var/www/storage/logs/laravel.log would be appreciated.

Bag72 commented 1 year ago

Thanks for replying. I have a post I can recreate it every time. So it isn't time related as far as I can see. I can create new posts but it seems it doesn't like me changing them. Just tried again. Edited, Save but didn't update. Console Output after successfully editing and saving a small file and failing the next. [php-fpm:access] 127.0.0.1 - 24/Apr/2023:20:20:51 +0000 "GET /index.php" 200 /var/www/public/index.php 111.203 2048 89.93% [php-fpm:access] 127.0.0.1 - 24/Apr/2023:20:21:43 +0000 "GET /index.php" 200 /var/www/public/index.php 97.648 2048 92.17% [php-fpm:access] 127.0.0.1 - 24/Apr/2023:20:21:43 +0000 "GET /index.php?withTags=true" 200 /var/www/public/index.php 99.941 2048 100.06% [php-fpm:access] 127.0.0.1 - 24/Apr/2023:20:21:43 +0000 "GET /index.php" 200 /var/www/public/index.php 103.044 2048 106.75% [php-fpm:access] 127.0.0.1 - 24/Apr/2023:20:21:51 +0000 "GET /index.php" 200 /var/www/public/index.php 77.876 2048 102.73% [php-fpm:access] 127.0.0.1 - 24/Apr/2023:20:21:51 +0000 "PATCH /index.php" 200 /var/www/public/index.php 92.642 2048 86.35% [php-fpm:access] 127.0.0.1 - 24/Apr/2023:20:21:51 +0000 "GET /index.php?collection_id=2&is_uncategorized=0&is_archived=false&limit=20&withTags=true" 200 /var/www/public/index.php 85.567 2048 93.49% [php-fpm:access] 127.0.0.1 - 24/Apr/2023:20:22:02 +0000 "GET /index.php" 200 /var/www/public/index.php 72.338 2048 82.94% [php-fpm:access] 127.0.0.1 - 24/Apr/2023:20:22:02 +0000 "GET /index.php?withTags=true" 200 /var/www/public/index.php 82.666 2048 96.77% [php-fpm:access] 127.0.0.1 - 24/Apr/2023:20:22:02 +0000 "GET /index.php" 200 /var/www/public/index.php 102.921 2048 106.88% [php-fpm:access] 127.0.0.1 - 24/Apr/2023:20:22:12 +0000 "GET /index.php" 200 /var/www/public/index.php 79.102 2048 101.14% [php-fpm:access] 127.0.0.1 - 24/Apr/2023:20:22:13 +0000 "GET /index.php?collection_id=2&is_uncategorized=0&is_archived=false&limit=20&withTags=true" 200 /var/www/public/index.php 92.440 2048 86.54% [php-fpm:access] 127.0.0.1 - 24/Apr/2023:20:22:18 +0000 "GET /index.php" 200 /var/www/public/index.php 106.784 2048 93.65% [php-fpm:access] 127.0.0.1 - 24/Apr/2023:20:22:18 +0000 "GET /index.php?withTags=true" 200 /var/www/public/index.php 83.202 2048 96.15% [php-fpm:access] 127.0.0.1 - 24/Apr/2023:20:22:18 +0000 "GET /index.php" 200 /var/www/public/index.php 91.210 2048 98.67% [php-fpm:access] 127.0.0.1 - 24/Apr/2023:20:22:12 +0000 "PATCH /index.php" 500 /var/www/public/index.php 10142.758 196600 17.65%

The last part of the Laravel.log

24 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle(Object(Illuminate\Http\Request), Object(Closure))

25 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

26 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))

27 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TrimStrings->handle(Object(Illuminate\Http\Request), Object(Closure))

28 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

29 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))

30 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

31 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(Object(Illuminate\Http\Request), Object(Closure))

32 /var/www/vendor/fruitcake/laravel-cors/src/HandleCors.php(52): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

33 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fruitcake\Cors\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure))

34 /var/www/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

35 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Http\Middleware\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))

36 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

37 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(142): Illuminate\Pipeline\Pipeline->then(Object(Closure))

38 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(111): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))

39 /var/www/public/index.php(52): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))

40 {main}

"}

Hope this helps.

fr0tt commented 1 year ago

Perhaps you can recreate a version of your post that fails, containing only the bar minimum and doesn't disclose anything personal that you could share.

Could you post (at least) the 24 previous lines of the log file (, because there are far more important) ?

Bag72 commented 1 year ago

I've attached a copy of the text that fails. I've removed the domain name but everything else is the same.

I created the file in Benote with no problems then went back later to format it properly and add in the config details. It wouldn't save the changes and didn't raise any error messages.

Also attached is the complete log file from the system. Add Torrent to System.txt laravel.log

Let me know if you need anything else.

fr0tt commented 1 year ago

Thanks. It might have something to do with that domain/link. Can you try to create a post only containing it and see if that fails or not ?

Bag72 commented 1 year ago

Mmmm. I can create a note with the domain in without an issue. I also managed to edit that note.

I have played about with it and I've noticed that it is removing formatting spaces. I can add text and it saves fine but it removes leading spaces and padded spaces on every save. This explains why there are no errors, the system is actually saving the data.

As I am trying to format the text by entering spaces it appears that it is not saving but it is.

Therefore when I raised this as Data not being saved that is incorrect. It is modifying data by stripping out extraneous spaces. Is that deliberate or a bug?

Bag72 commented 1 year ago

I've played a bit more.

The software edits the text that is input removing text and modifying text depending on the input. For example I am recording my CRON settings and there are a lot of there. They edit the lines and. How can I put in 5 * into the file. More importantly how can I stop the text from changing. I tried to restore a system and benotes had modified the text and I couldn't install it without going back as if it was a first install. That negates its use for me.

In addition it has now started saying error unable to save file for simple files. Error: Post could not be created. I wiped the system and restarted and it still says error. I've attached the complete log and the file entry that fails.

Text.txt laravel.log

fr0tt commented 1 year ago

I'm sorry I didn't answer sooner. I haven't had the chance to resolve your issue but I wanted to you let you know that I haven't forgotten you yet ;) Currently I can only say that the ip address does not seem to be the root of the issue (which might have made sense) and your latest log file probably does not include anything intertwined with your issue. (Thou I'm still investigating why that particular error (message) happens.)

Bag72 commented 1 year ago

OK. thanks for responding. I'm going to try embedding the docker container in a LXD container. See what happens there to fix the writing issue.

The truncation and the reformatting are clearly coding and/or browser issues. I'll try different browsers to help you diagnose the problem. When you get around to it ping me and I'll help diagnose where I can.

fr0tt commented 1 year ago

So I had some time so can I tell you know:

Bag72 commented 1 year ago

I understand about markdown but I interpreted the 'supports both markdown and a rich text editor' as it was optional and it isn't. So it is 'uses markdown' How do I use the rich text editor instead of markdown?

I tired code blocks and they still truncated the lines so all the YAML and JSON files are wrong. How did you do the docker-compose block?

fr0tt commented 1 year ago

You use both at the same time. You can either use markdown syntax or use the buttons.

Well I created an empty code block with:

and then pasted your content in it.

Bag72 commented 1 year ago

Ah. OK. I managed to create one from the markup guide you link too. So far its allowing me to add them back and now I understand the formatting issue I'm full speed ahead.

Thanks for the help. It is much appreciated. I'll close this down and if the errors appear again I'll open another issue.

fr0tt commented 1 year ago

If you rather prefer to achieve it without markdown syntax you can also click on the code button and then past your content afterwards inside it.

Bag72 commented 1 year ago

LOL. If only I had clicked a few buttons but I just assumed it wasn't saving and wend down the wrong path. Once that assumption was made I didn't try anything else.

Thanks for the easy solution. I've been playing with the buttons and they do what I want. So I'm happy.