edissyum / opencapture

Open-Capture is the one and only 100% Open Source intelligent document capture solution
https://kutt.it/OpenCaptureWebSite
GNU General Public License v3.0
24 stars 11 forks source link

error server 500 #1308

Closed rayansdsd closed 8 months ago

rayansdsd commented 8 months ago

hey when i am using opencapture on the web i tried to use the fonction duplicate when i do that i have this error http://localhost/backend_oc/edissyum/ws/positions_masks/duplicate/1. 500: Internal Server Error.

Capture d'écran 2024-02-27 112358 /var/www/html/opencapture/data/log/OpenCapture.log no file of this type

sudo tail -f /var/log/apache2/error.log;

ian:/var/www/html/opencapture/data/log# sudo adduser rayan sudo adduser : L'utilisateur « rayan » appartient déjà au groupe « sudo ». root@debian:/var/www/html/opencapture/data/log# sudo tail -f /var/log/apache2/error.log [Tue Feb 27 11:27:54.896753 2024] [wsgi:error] [pid 18301] [remote 127.0.0.1:36878] File "/var/www/html/opencapture/src/backend/rest/positions_masks.py", line 145, in duplicate_positions_mask [Tue Feb 27 11:27:54.896756 2024] [wsgi:error] [pid 18301] [remote 127.0.0.1:36878] res = positions_masks.duplicate_positions_mask(position_mask_id) [Tue Feb 27 11:27:54.896758 2024] [wsgi:error] [pid 18301] [remote 127.0.0.1:36878] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [Tue Feb 27 11:27:54.896761 2024] [wsgi:error] [pid 18301] [remote 127.0.0.1:36878] File "/var/www/html/opencapture/src/backend/controllers/positions_masks.py", line 178, in duplicate_positionsmask [Tue Feb 27 11:27:54.896763 2024] [wsgi:error] [pid 18301] [remote 127.0.0.1:36878] , error = positions_masks.add_positions_mask(args) [Tue Feb 27 11:27:54.896766 2024] [wsgi:error] [pid 18301] [remote 127.0.0.1:36878] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [Tue Feb 27 11:27:54.896768 2024] [wsgi:error] [pid 18301] [remote 127.0.0.1:36878] File "/var/www/html/opencapture/src/backend/models/positions_masks.py", line 131, in add_positions_mask [Tue Feb 27 11:27:54.896771 2024] [wsgi:error] [pid 18301] [remote 127.0.0.1:36878] 'form_id': args['form_id'], [Tue Feb 27 11:27:54.896773 2024] [wsgi:error] [pid 18301] [remote 127.0.0.1:36878] ~~~~^^^^^^^^^^^ [Tue Feb 27 11:27:54.896775 2024] [wsgi:error] [pid 18301] [remote 127.0.0.1:36878] KeyError: 'form_id'

please help me and is the problem come from my configuration or not i want to mention that when i installed the product i used this tutorial https://edissyum.gitbook.io/open-capture/technique/installation

and i made id = edissyum user the name of my user and its password and all the other paramters are default

thank you so much foir answering me

nathan30 commented 8 months ago

Hi,

Are you using the latest version ?

nathan30 commented 8 months ago

I just test it internally and fix the issue https://github.com/edissyum/opencapture/commit/fbdd115359c979210fbeeeb150f294332b178bd6

Thanks for your report

You can wait for the new version or manually pass the fix

After you fixed your instance you have to restart apache2

rayansdsd commented 8 months ago

how i can know if i'm using the latest version

nathan30 commented 8 months ago

You can go to settings, about us Or disconnect and check on the bottom right of the login page

rayansdsd commented 8 months ago

i am using Open-Capture version 3.1.2

nathan30 commented 8 months ago

I just test it internally and fix the issue fbdd115

Thanks for your report

You can wait for the new version or manually pass the fix

After you fixed your instance you have to restart apache2

You have the fix here

rayansdsd commented 8 months ago

so i sjould copy this code in my files?

nathan30 commented 8 months ago

Yes. You just have to add 'form_id': positions_masks_info['form_id'], in the function duplicate_positions_masks line 171 of the file src/backend/controllers/positions_masks.py

rayansdsd commented 8 months ago

sorry but i can't find the file src/backend/controllers/positions_masks.py i have no directory source on my linux device

nathan30 commented 8 months ago

The directory source is /var/www/html/opencapture/

rayansdsd commented 8 months ago

thank you so much it's working but i have another problem when i tried to create a new masque i have the same probleme Capture d'écran 2024-02-27 120738

rayansdsd commented 8 months ago

can you please answer me thank you

nathan30 commented 8 months ago

Show me the log. I didn't have the issue

rayansdsd commented 8 months ago

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [Tue Feb 27 12:11:39.604105 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:51984] File "/var/www/html/opencapture/src/backend/models/positions_masks.py", line 141, in add_positions_mask [Tue Feb 27 12:11:39.604108 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:51984] res = database.insert(args) [Tue Feb 27 12:11:39.604111 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:51984] ^^^^^^^^^^^^^^^^^^^^^ [Tue Feb 27 12:11:39.604113 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:51984] File "/var/www/html/opencapture/src/backend/classes/Database.py", line 121, in insert [Tue Feb 27 12:11:39.604116 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:51984] cursor.execute(query) [Tue Feb 27 12:11:39.604118 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:51984] psycopg2.errors.InvalidTextRepresentation: ERREUR: syntaxe en entr\xc3\xa9e invalide pour le type integer : \xc2\xab \xc2\xbb [Tue Feb 27 12:11:39.604120 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:51984] LINE 1: ...id, pages, regex, positions) VALUES ('test', '2', '', '{}', ... [Tue Feb 27 12:11:39.604123 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:51984] ^ [Tue Feb 27 12:11:39.604125 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:51984]

rayansdsd commented 8 months ago

sorry the full log (opencapture) rayan@debian:~$ sudo tail -f /var/log/apache2/error.log [sudo] Mot de passe de rayan : [Tue Feb 27 12:11:39.604103 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:51984] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [Tue Feb 27 12:11:39.604105 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:51984] File "/var/www/html/opencapture/src/backend/models/positions_masks.py", line 141, in add_positions_mask [Tue Feb 27 12:11:39.604108 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:51984] res = database.insert(args) [Tue Feb 27 12:11:39.604111 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:51984] ^^^^^^^^^^^^^^^^^^^^^ [Tue Feb 27 12:11:39.604113 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:51984] File "/var/www/html/opencapture/src/backend/classes/Database.py", line 121, in insert [Tue Feb 27 12:11:39.604116 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:51984] cursor.execute(query) [Tue Feb 27 12:11:39.604118 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:51984] psycopg2.errors.InvalidTextRepresentation: ERREUR: syntaxe en entr\xc3\xa9e invalide pour le type integer : \xc2\xab \xc2\xbb [Tue Feb 27 12:11:39.604120 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:51984] LINE 1: ...id, pages, regex, positions) VALUES ('test', '2', '', '{}', ... [Tue Feb 27 12:11:39.604123 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:51984] ^ [Tue Feb 27 12:11:39.604125 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:51984]

nathan30 commented 8 months ago

I think you insert bad data when creating your position mask. Share a screenshot of data before create position mask please

rayansdsd commented 8 months ago

Capture d'écran 2024-02-27 142220

rayansdsd commented 8 months ago

i have an error as i alreeady show u for the log i ha ve this (opencapture) rayan@debian:~$ sudo tail -f /var/log/apache2/error.log [sudo] Mot de passe de rayan : [Tue Feb 27 14:22:54.512681 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:58612] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [Tue Feb 27 14:22:54.512684 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:58612] File "/var/www/html/opencapture/src/backend/models/positions_masks.py", line 141, in add_positions_mask [Tue Feb 27 14:22:54.512687 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:58612] res = database.insert(args) [Tue Feb 27 14:22:54.512690 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:58612] ^^^^^^^^^^^^^^^^^^^^^ [Tue Feb 27 14:22:54.512692 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:58612] File "/var/www/html/opencapture/src/backend/classes/Database.py", line 121, in insert [Tue Feb 27 14:22:54.512695 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:58612] cursor.execute(query) [Tue Feb 27 14:22:54.512698 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:58612] psycopg2.errors.InvalidTextRepresentation: ERREUR: syntaxe en entr\xc3\xa9e invalide pour le type integer : \xc2\xab \xc2\xbb [Tue Feb 27 14:22:54.512701 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:58612] LINE 1: ..._id, pages, regex, positions) VALUES ('ABS', '1', '', '{}', ... [Tue Feb 27 14:22:54.512708 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:58612] ^ [Tue Feb 27 14:22:54.512712 2024] [wsgi:error] [pid 1005] [remote 127.0.0.1:58612]

nathan30 commented 8 months ago

I need to see the postgres request that fail. Check /var/log/postgres-XX.main.log

You should see the request that trigger error

rayansdsd commented 8 months ago

i ha ve no log called postgres-XX.main.log in /var/log/. (opencapture) rayan@debian:~$ cd /var/log (opencapture) rayan@debian:/var/log$ dir alternatives.log installer vmware-network.1.log apache2 journal vmware-network.log apt lastlog vmware-vmsvc-root.1.log boot.log postgresql vmware-vmsvc-root.log btmp private vmware-vmtoolsd-rayan.log cups rabbitmq vmware-vmtoolsd-root.log dpkg.log README vmware-vmusr-rayan.log faillog runit watcher fontconfig.log speech-dispatcher wtmp gdm3 sysstat (opencapture) rayan@debian:/var/log$ cat postgres-XX.main.log cat: postgres-XX.main.log: Aucun fichier ou dossier de ce type

nathan30 commented 8 months ago

Replace XX by the installed version of postgres on your server

rayansdsd commented 8 months ago

here it is thye postgree log;

(opencapture) rayan@debian:/var/log/postgresql$ sudo cat postgresql-15-main.log [sudo] Mot de passe de rayan : 2024-02-27 10:52:54.464 CET [5606] LOG: démarrage de PostgreSQL 15.6 (Debian 15.6-0+deb12u1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit 2024-02-27 10:52:54.464 CET [5606] LOG: en écoute sur IPv6, adresse « ::1 », port 5432 2024-02-27 10:52:54.464 CET [5606] LOG: en écoute sur IPv4, adresse « 127.0.0.1 », port 5432 2024-02-27 10:52:54.465 CET [5606] LOG: écoute sur la socket Unix « /var/run/postgresql/.s.PGSQL.5432 » 2024-02-27 10:52:54.470 CET [5609] LOG: le système de bases de données a été arrêté à 2024-02-27 10:52:52 CET 2024-02-27 10:52:54.477 CET [5606] LOG: le système de bases de données est prêt pour accepter les connexions 2024-02-27 10:57:54.584 CET [5607] LOG: début du checkpoint : time 2024-02-27 10:57:59.171 CET [5607] LOG: checkpoint terminé : a écrit 47 tampons (0.3%); 0 fichiers WAL ajoutés, 0 supprimés, 0 recyclés ; écriture=4.557 s, synchronisation=0.005 s, total=4.602 s; fichiers synchronisés=15, plus long=0.004 s, moyenne=0.001 s; distance=255 kB, estimation=255 kB 2024-02-27 11:02:54.340 CET [5607] LOG: début du checkpoint : time 2024-02-27 11:04:51.609 CET [5607] LOG: checkpoint terminé : a écrit 1111 tampons (6.8%); 0 fichiers WAL ajoutés, 0 supprimés, 0 recyclés ; écriture=117.231 s, synchronisation=0.012 s, total=117.269 s; fichiers synchronisés=485, plus long=0.007 s, moyenne=0.001 s; distance=5316 kB, estimation=5316 kB 2024-02-27 11:07:54.710 CET [5607] LOG: début du checkpoint : time 2024-02-27 11:07:56.375 CET [5607] LOG: checkpoint terminé : a écrit 17 tampons (0.1%); 0 fichiers WAL ajoutés, 0 supprimés, 0 recyclés ; écriture=1.629 s, synchronisation=0.005 s, total=1.667 s; fichiers synchronisés=11, plus long=0.004 s, moyenne=0.001 s; distance=27 kB, estimation=4787 kB 2024-02-27 11:44:50.505 CET [32656] rayan@opencapture_edissyum ERREUR: syntaxe en entrée invalide pour le type integer : « » au caractère 105 2024-02-27 11:44:50.505 CET [32656] rayan@opencapture_edissyum INSTRUCTION : INSERT INTO positions_masks (label, form_id, supplier_id, pages, regex, positions) VALUES ('test', '1', '', '{}', '{}', '{}') RETURNING id 2024-02-27 11:47:55.059 CET [5607] LOG: début du checkpoint : time 2024-02-27 11:47:55.909 CET [5607] LOG: checkpoint terminé : a écrit 9 tampons (0.1%); 0 fichiers WAL ajoutés, 0 supprimés, 0 recyclés ; écriture=0.832 s, synchronisation=0.003 s, total=0.855 s; fichiers synchronisés=8, plus long=0.002 s, moyenne=0.001 s; distance=0 kB, estimation=4308 kB 2024-02-27 11:59:03.272 CET [915] LOG: démarrage de PostgreSQL 15.6 (Debian 15.6-0+deb12u1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit 2024-02-27 11:59:03.280 CET [915] LOG: en écoute sur IPv6, adresse « ::1 », port 5432 2024-02-27 11:59:03.280 CET [915] LOG: en écoute sur IPv4, adresse « 127.0.0.1 », port 5432 2024-02-27 11:59:03.283 CET [915] LOG: écoute sur la socket Unix « /var/run/postgresql/.s.PGSQL.5432 » 2024-02-27 11:59:03.483 CET [989] LOG: le système de bases de données a été interrompu ; dernier lancement connu à 2024-02-27 11:47:55 CET 2024-02-27 11:59:03.838 CET [989] LOG: le système de bases de données n'a pas été arrêté proprement ; restauration automatique en cours 2024-02-27 11:59:03.907 CET [989] LOG: la ré-exécution commence à 0/1A79240 2024-02-27 11:59:03.907 CET [989] LOG: longueur invalide de l'enregistrement à 0/1A79328 : voulait 24, a eu 0 2024-02-27 11:59:03.907 CET [989] LOG: rejeu exécuté à 0/1A792F0 utilisation système : CPU : utilisateur : 0.00 s, système : 0.00 s, temps passé : 0.00 s 2024-02-27 11:59:03.952 CET [987] LOG: début du checkpoint : end-of-recovery immediate wait 2024-02-27 11:59:03.962 CET [987] LOG: checkpoint terminé : a écrit 3 tampons (0.0%); 0 fichiers WAL ajoutés, 0 supprimés, 0 recyclés ; écriture=0.002 s, synchronisation=0.001 s, total=0.013 s; fichiers synchronisés=2, plus long=0.001 s, moyenne=0.001 s; distance=0 kB, estimation=0 kB 2024-02-27 11:59:04.073 CET [915] LOG: le système de bases de données est prêt pour accepter les connexions 2024-02-27 12:04:03.593 CET [987] LOG: début du checkpoint : time 2024-02-27 12:04:04.027 CET [987] LOG: checkpoint terminé : a écrit 5 tampons (0.0%); 0 fichiers WAL ajoutés, 0 supprimés, 0 recyclés ; écriture=0.413 s, synchronisation=0.004 s, total=0.440 s; fichiers synchronisés=5, plus long=0.003 s, moyenne=0.001 s; distance=0 kB, estimation=0 kB 2024-02-27 12:05:23.115 CET [5296] rayan@opencapture_edissyum ERREUR: syntaxe en entrée invalide pour le type integer : « » au caractère 105 2024-02-27 12:05:23.115 CET [5296] rayan@opencapture_edissyum INSTRUCTION : INSERT INTO positions_masks (label, form_id, supplier_id, pages, regex, positions) VALUES ('test', '2', '', '{}', '{}', '{}') RETURNING id 2024-02-27 12:07:31.598 CET [5902] rayan@opencapture_edissyum ERREUR: syntaxe en entrée invalide pour le type integer : « » au caractère 105 2024-02-27 12:07:31.598 CET [5902] rayan@opencapture_edissyum INSTRUCTION : INSERT INTO positions_masks (label, form_id, supplier_id, pages, regex, positions) VALUES ('test', '2', '', '{}', '{}', '{}') RETURNING id 2024-02-27 12:09:03.127 CET [987] LOG: début du checkpoint : time 2024-02-27 12:09:03.654 CET [987] LOG: checkpoint terminé : a écrit 6 tampons (0.0%); 0 fichiers WAL ajoutés, 0 supprimés, 0 recyclés ; écriture=0.516 s, synchronisation=0.003 s, total=0.527 s; fichiers synchronisés=6, plus long=0.002 s, moyenne=0.001 s; distance=0 kB, estimation=0 kB 2024-02-27 12:11:39.600 CET [7436] rayan@opencapture_edissyum ERREUR: syntaxe en entrée invalide pour le type integer : « » au caractère 105 2024-02-27 12:11:39.600 CET [7436] rayan@opencapture_edissyum INSTRUCTION : INSERT INTO positions_masks (label, form_id, supplier_id, pages, regex, positions) VALUES ('test', '2', '', '{}', '{}', '{}') RETURNING id 2024-02-27 14:22:54.348 CET [45917] rayan@opencapture_edissyum ERREUR: syntaxe en entrée invalide pour le type integer : « » au caractère 104 2024-02-27 14:22:54.348 CET [45917] rayan@opencapture_edissyum INSTRUCTION : INSERT INTO positions_masks (label, form_id, supplier_id, pages, regex, positions) VALUES ('ABS', '1', '', '{}', '{}', '{}') RETURNING id (opencapture) rayan@debian:/var/log/postgresql$

nathan30 commented 8 months ago

How do you select your supplier ? Because it's missing in the request

rayansdsd commented 8 months ago

i'm just filling in the gaps like you see or you mean how i m chosing the name because i am giving just test names till now modifier142220

nathan30 commented 8 months ago

You have to create a third party account before, and then select it in your mask

image

rayansdsd commented 8 months ago

it's working thank you so much.

rayansdsd commented 8 months ago

parfait