gs1 / GS1_DigitalLink_Resolver_CE

The GS1 DigitalLink Resolver Community Edition
Apache License 2.0
38 stars 22 forks source link

API new returning error 500 #94

Closed angel-uos closed 1 month ago

angel-uos commented 2 months ago

Hello,

After a fresh installation of v3, I tried the 'setup_test.py' script, but I got an error 500 when adding a new document. Find below the log. Is there any step missing in the installation process? Thanks for your help.

2024-07-12 09:40:47 data-entry-server | Document is already in v3 format 2024-07-12 09:40:47 data-entry-server | _process_document_insert: Error processing document: '_id' 2024-07-12 09:40:47 data-entry-server | Traceback (most recent call last): 2024-07-12 09:40:47 data-entry-server | File "/app/data_entry_logic.py", line 284, in _process_document_upsert 2024-07-12 09:40:47 data-entry-server | read_result = data_entry_db.read_document(authored_doc['_id']) 2024-07-12 09:40:47 data-entry-server | KeyError: '_id' 2024-07-12 09:40:47 data-entry-server | 2024-07-12 09:40:47 data-entry-server | DEBUG response_data: "{'response_status': 500, 'error': "Internal Server Error - '_id'"}", http_response_status: "500" 2024-07-12 09:40:47 data-entry-server | INFO:werkzeug:172.18.0.5 - - [12/Jul/2024 08:40:47] "POST /api/new HTTP/1.0" 500 - 2024-07-12 09:40:47 frontend-proxy-server | 192.168.65.1 - - [12/Jul/2024:08:40:47 +0000] "POST /api/new HTTP/1.1" 500 67 "-" "python-requests/2.32.3" "-"

nicklansley commented 1 month ago

HI Angel, thanks for picking this up. It was caused by a refactoring of internal error code (the various layers of Resolver 3.0 act as APIs to each other, so data is included with response codes).

Anyway, here is what the output should do! Please git pull to bring your code base up to date then run in docker as before. Let me know if it works for you then I'll close the issue.

 Running Create / Read / Update / Delete cycle test on data entry
Initially delete the entry with anchor /01/09506000134352 using DELETE /entry
Initially delete the entry with anchor /01/09506000134376 using DELETE /entry
Initially delete the entry with anchor /8004/0950600013430000001 using DELETE /entry
Initially delete the entry with anchor /8004/095060001343 using DELETE /entry
Now create the entry with anchor /01/09506000134352 using POST /new
Now create the entry with anchor /01/09506000134376 using POST /new
Now create the entry with anchor /01/09506000134376 using POST /new
Now create the entry with anchor /01/09506000134376 using POST /new
Now create the entry with anchor /8004/0950600013430000001 using POST /new
Now create the entry with anchor /8004/095060001343 using POST /new
Now read the entry with anchor /01/09506000134352
Now read the entry with anchor /01/09506000134376
Now read the entry with anchor /01/09506000134376
Now read the entry with anchor /01/09506000134376
Now read the entry with anchor /8004/0950600013430000001
Now read the entry with anchor /8004/095060001343
Now find the entry with anchor /01/09506000134376 using the Resolver frontend web server
Requesting:  http://localhost:8080/01/09506000134376
Now find the serialized entry /01/09506000134376/21/HELLOWORLD using the Resolver frontend web server
Now find the lot numbered entry /01/09506000134376/10/LOT01 using the Resolver frontend web server
Now find the entry with anchor /01/09506000134352 using the Resolver frontend web server
that has Linktype: gs1:hasRetailers  and Language: en
Now find the entry with anchor /01/09506000134352 using the Resolver frontend web server
that has Linktype: gs1:hasRetailers  and Language: es
Now find the entry with anchor /01/09506000134352 using the Resolver frontend web server
that has Linktype: gs1:hasRetailers  and Language: vi
Now find the entry with anchor /01/09506000134352 using the Resolver frontend web server
that has Linktype: gs1:hasRetailers  and Language: ja
Now find the entry with anchor /01/09506000134352 using the Resolver frontend web server
that has Linktype: gs1:pip  and Language: en
Now find the entry with anchor /01/09506000134352 using the Resolver frontend web server
that has Linktype: gs1:pip  and Language: es
Now find the entry with anchor /01/09506000134352 using the Resolver frontend web server
that has Linktype: gs1:pip  and Language: vi
Now find the entry with anchor /01/09506000134352 using the Resolver frontend web server
that has Linktype: gs1:pip  and Language: ja
Now find the entry with anchor /01/09506000134352 using the Resolver frontend web server
that has Linktype: gs1:recipeInfo  and Language: en
Now find the entry with anchor /01/09506000134352 using the Resolver frontend web server
that has Linktype: gs1:recipeInfo  and Language: es
Now find the entry with anchor /01/09506000134352 using the Resolver frontend web server
that has Linktype: gs1:recipeInfo  and Language: vi
Now find the entry with anchor /01/09506000134352 using the Resolver frontend web server
that has Linktype: gs1:recipeInfo  and Language: ja
Now find the entry with anchor /01/09506000134352 using the Resolver frontend web server
that has Linktype: gs1:sustainabilityInfo  and Language: en
Now find the entry with anchor /01/09506000134352 using the Resolver frontend web server
that has Linktype: gs1:sustainabilityInfo  and Language: es
Now find the entry with anchor /01/09506000134352 using the Resolver frontend web server
that has Linktype: gs1:sustainabilityInfo  and Language: vi
Now find the entry with anchor /01/09506000134352 using the Resolver frontend web server
that has Linktype: gs1:sustainabilityInfo  and Language: ja
Now find the entry with anchor /01/09506000134376 using the Resolver frontend web server
that has Linktype: gs1:registerProduct and "Accept-Language" header: en-GB,en;q=0.9,en-US;q=0.8,en-IE;q=0.7
Now find the entry with anchor /01/09506000134376 using the Resolver frontend web server
that has Linktype: gs1:registerProduct and "Accept-Language" header: en,en-US;q=0.8,en-IE;q=0.7
Now find the entry with anchor /01/09506000134376 using the Resolver frontend web server
that has Linktype: gs1:registerProduct and "Accept-Language" header: en-US,en;q=0.9,en-GB;q=0.8,en-IE;q=0.7
Now find the entry with anchor /01/09506000134376 using the Resolver frontend web server
that has Linktype: gs1:registerProduct and "Accept-Language" header: en-IE,en;q=0.9,en-GB;q=0.8,en-US;q=0.7
Now find the entry with anchor /01/09506000134376 using the Resolver frontend web server
that has Linktype: gs1:registerProduct and "Accept-Language" header: fr-BE,fr-FR;q=0.8,fr;q-0.7
Request linktype gs1:safetyInfo /01/09506000134376 using the Resolver frontend web server
HTTP 300 test - Request linktype gs1:certificationInfo /01/09506000134376/10/LOT01 using the Resolver frontend web server
Now find the fixed asset /8004/0950600013430000001 using the Resolver frontend web server
Now find the variable asset /8004/095060001343999999 using the Resolver frontend web server
Location: https://dalgiardino.com/medicinal-compound/assets?giai=095060001343999999
delete the entry with anchor /01/09506000134352 using DELETE /entry
delete the entry with anchor /01/09506000134376 using DELETE /entry
delete the entry with anchor /8004/0950600013430000001 using DELETE /entry
delete the entry with anchor /8004/095060001343 using DELETE /entry
Data entry CRUD cycle test completed successfully - all data entries deleted from the database
.
----------------------------------------------------------------------
Ran 1 test in 1.135s
angel-uos commented 1 month ago

Hi Nick,

Thank you for fixing this. It works now.

nicklansley commented 1 month ago

Great, thank you!