Person page won't load but the data is in there (Gramps Web)

Gramps 5.1.6
Gramps Web API 1.5.0
Gramps.js 23.12.0
locale: en
multi-tree: false
task queue: true


I’m hoping someone can help but I may need guidance on generating a proper error/debug report.

I was editing a person in Gramps. I’m using Gramps Web through Digital Ocean.
Specifically I was trying to associate a media object with them. And something broke.

Now on that person record, I’m getting Error: Error 500 However, the files and associations associated with that person are still there.

I don’t know how to get a proper bug report through the console in Digital Ocean, but if you can point me in the direction, I will do so. I’ve tried for a bit today to figure it out but haven’t been able to.

(I’ve also tried exporting the XML file and Web Sync but was unable to do either. I am separately trying to troubleshoot both those. So far, everything in general has been working great and I really love the project.)

Hi, this and the related issue (Gramps Web export issue [XML - can only concatenate str (not "NoneType") to str] & [GEDCOM - HandleError()]) looks like you have a corrupted object which has “None” as handle somewhere. Can you please open the browser dev tools (F12), look at the response of the respective API call (/api/person/somehandle/...) and post the JSON here (after redacting sensitive data, if any)?

Of course, thank you so much @DavidMStraub. Here it is with the domain obscured:

(index):1 ServiceWorker registered.
3124eda5.js:373 
        
        
       GET https://*****.***/api/people/?gramps_id=I0042&locale=en&profile=all&backlinks=true&extend=all 500 (Internal Server Error)
nr @ 3124eda5.js:373
_updateData @ 3124eda5.js:2856
update @ 3124eda5.js:2856
performUpdate @ 3124eda5.js:2
scheduleUpdate @ 3124eda5.js:2
_$EC @ 3124eda5.js:2
await in _$EC (async)
requestUpdate @ 3124eda5.js:2
set @ 3124eda5.js:2
_$AK @ 3124eda5.js:2
attributeChangedCallback @ 3124eda5.js:2
k @ 3124eda5.js:2
_$AI @ 3124eda5.js:2
m @ 3124eda5.js:2
T @ 3124eda5.js:2
_$AI @ 3124eda5.js:2
m @ 3124eda5.js:2
T @ 3124eda5.js:2
_$AI @ 3124eda5.js:2
D @ 3124eda5.js:2
update @ 3124eda5.js:2
update @ 3124eda5.js:10356
performUpdate @ 3124eda5.js:2
scheduleUpdate @ 3124eda5.js:2
_$EC @ 3124eda5.js:2
await in _$EC (async)
requestUpdate @ 3124eda5.js:2
set @ 3124eda5.js:2
_loadPage @ 3124eda5.js:10356
_handleNav @ 3124eda5.js:10356
ks @ 3124eda5.js:389
_handleClick @ 3124eda5.js:1946
(anonymous) @ 3124eda5.js:1917
handleEvent @ 3124eda5.js:2

Hi, can you please go to the “Network” tab, refresh, look for the request with the /api/person/... URL and look at the “Response” tab? That should contain the raw JSON data for the person.

2 Likes

I hope I’m doing this right, here’s a screenshot:

When I double click the error under that “Name” column, it opens up a new tab with this url:

https://**./api/people/?gramps_id=I0042&locale=en&profile=all&backlinks=true&extend=all

And on that page, the following error is displayed:

{"msg":"Missing JWT in headers or query_string (Missing Authorization Header; Missing 'jwt' query paramater)"}

Thanks for sharing, I hadn’t realized that if it raises an error 500 the developer tools are not helpful :confused:

Can you look at the logs by sshing into the virtual machine and doing

cd /opt/grampsweb
docker-compose logs grampsweb

How did you get the data into Gramps Web? By importing an XML or creating objects manually?

Sure of course. This is probably too much info but I’m not sure exactly what’s useful or not. I’m starting with the most recent place I see this person object (I0042) being referenced in the logs.

The data was input into Gramps Web by creating objects manually.

The object was working quite well actually it just came up when I was trying to link or unlink—sorry I can’t remember—a media object to the person.

BTW if it’s easiest, I’m fine with deleting the person and recreating.

grampsweb           | gramps.gen.errors.HandleError: Handle is None
grampsweb           | [2024-01-16 15:48:30 +0000] [15] [ERROR] Error handling request /api/people/?gramps_id=I0042&locale=en&profile=all&backlinks=true&extend=all
grampsweb           | Traceback (most recent call last):
grampsweb           |   File "/usr/local/lib/python3.11/dist-packages/gunicorn/workers/sync.py", line 135, in handle
grampsweb           |     self.handle_request(listener, req, client, addr)
grampsweb           |   File "/usr/local/lib/python3.11/dist-packages/gunicorn/workers/sync.py", line 178, in handle_request
grampsweb           |     respiter = self.wsgi(environ, resp.start_response)
grampsweb           |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
grampsweb           |   File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 1478, in __call__
grampsweb           |     return self.wsgi_app(environ, start_response)
grampsweb           |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
grampsweb           |   File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 1458, in wsgi_app
grampsweb           |     response = self.handle_exception(e)
grampsweb           |                ^^^^^^^^^^^^^^^^^^^^^^^^
grampsweb           |   File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 1455, in wsgi_app
grampsweb           |     response = self.full_dispatch_request()
grampsweb           |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
grampsweb           |   File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 869, in full_dispatch_request
grampsweb           |     rv = self.handle_user_exception(e)
grampsweb           |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
grampsweb           |   File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 867, in full_dispatch_request
grampsweb           |     rv = self.dispatch_request()
grampsweb           |          ^^^^^^^^^^^^^^^^^^^^^^^
grampsweb           |   File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 852, in dispatch_request
grampsweb           |     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
grampsweb           |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
grampsweb           |   File "/usr/local/lib/python3.11/dist-packages/gramps_webapi/api/auth.py", line 44, in wrapper
grampsweb           |     return func(*args, **kwargs)
grampsweb           |            ^^^^^^^^^^^^^^^^^^^^^
grampsweb           |   File "/usr/local/lib/python3.11/dist-packages/flask/views.py", line 109, in view
grampsweb           |     return current_app.ensure_sync(self.dispatch_request)(**kwargs)
grampsweb           |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
grampsweb           |   File "/usr/local/lib/python3.11/dist-packages/flask/views.py", line 190, in dispatch_request
grampsweb           |     return current_app.ensure_sync(meth)(**kwargs)
grampsweb           |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
grampsweb           |   File "/usr/local/lib/python3.11/dist-packages/webargs/core.py", line 649, in wrapper
grampsweb           |     return func(*args, **kwargs)
grampsweb           |            ^^^^^^^^^^^^^^^^^^^^^
grampsweb           |   File "/usr/local/lib/python3.11/dist-packages/gramps_webapi/api/resources/base.py", line 387, in get
grampsweb           |     200, [self.full_object(obj, args, locale=locale)], args, total_items=1
grampsweb           |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
grampsweb           |   File "/usr/local/lib/python3.11/dist-packages/gramps_webapi/api/resources/base.py", line 91, in full_object
grampsweb           |     obj = self.object_extend(obj, args, locale=locale)
grampsweb           |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
grampsweb           |   File "/usr/local/lib/python3.11/dist-packages/gramps_webapi/api/resources/people.py", line 56, in object_extend
grampsweb           |     obj.extended = get_extended_attributes(db_handle, obj, args)
grampsweb           |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
grampsweb           |   File "/usr/local/lib/python3.11/dist-packages/gramps_webapi/api/resources/util.py", line 638, in get_extended_attributes
grampsweb           |     result["media"] = [
grampsweb           |                       ^
grampsweb           |   File "/usr/local/lib/python3.11/dist-packages/gramps_webapi/api/resources/util.py", line 639, in <listcomp>
grampsweb           |     db_handle.get_media_from_handle(media_ref.ref)
grampsweb           |   File "/usr/lib/python3/dist-packages/gramps/gen/db/generic.py", line 1297, in get_media_from_handle
grampsweb           |     return self._get_from_handle(MEDIA_KEY, Media, handle)
grampsweb           |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
grampsweb           |   File "/usr/lib/python3/dist-packages/gramps/gen/db/generic.py", line 1263, in _get_from_handle
grampsweb           |     raise HandleError('Handle is None')
grampsweb           | gramps.gen.errors.HandleError: Handle is None
grampsweb           | ERROR:root:Error parsing list of recent DBs from file /root/.gramps/recent-files-gramps.xml: no element found: line 1, column 0.
grampsweb           | This might indicate a damage to your files.
grampsweb           | If you're sure there is no problem with other files, delete it, and restart Gramps.
root@grampsweb0222onubuntu2004-s-1vcpu-1gb-amd-sfo3-01:/opt/grampsweb# 
1 Like

Hi, yes, deleting the person should fix the issue, but we (devs) should check how this can happen and in general we should also make the backend more robust to such inconsistencies (e.g. just ignore the non-existing media object rather than raise an error). There was a related error reported with missing place reference Deleting Enclosing parent causes 500 error on children · Issue #471 · gramps-project/gramps-webapi · GitHub

Understood, thanks so much for your help.

Happy to re-create the person for now but I think I do need to delete or modify the old record so it’s not a ghost in the system that comes up with each search, tagging, etc.

Now my question is how can I delete the person object with Gramps Web without being able to load them in the UI?

My guess is I could try to open some file with nano or vim or something and remove a line? I really don’t how. I’m trying to troubleshoot web sync otherwise I’d try that way.

(I’m looking at setting up daily snapshots with SnapShooter so I can more easily rollback in the future. For now I have backups from DO but they’re not frequent enough, so I’m probably going to switch.)

In the newly released Gramps Web API version 1.5.1, I added better error handling for handle errors. Could you please update your docker image and check if you can now load the object?

1 Like

:see_no_evil: can you advise on how to do this?

I ran apt-get update and apt-get upgrade (I’ve used Linux but only on desktop), not familiar with Docker but realized it it’s a different process.

Tried to go through the terminal, I was able to find the old docker images, stop them, and remove them. When I went to install the new ones, I hit an error because I wasn’t sure the family tree name. And I’m not sure how to find that.

I tried looking at an old Gramps XML file I’d had on my machine and used family_tree_1 but that didn’t work heh. So basically I got here and then stuck:

docker run -d --name grampsweb -e TREE=your_tree_name ghcr.io/gramps-project/grampsweb:latest
docker run -d --name grampsweb_celery -e TREE=your_tree_name ghcr.io/gramps-project/grampsweb:latest

I rolled back to a previous version so no data loss or anything.

I think I just need to know how to find my family tree name.

Okay! With some helpChatGPT I was able to figure part of this out:

cd /opt/grampsweb
docker-compose pull
docker-compose up -d --force-recreate
docker ps

I rebooted it from the Digital Ocean console and it looks like at a minimum Gramps.js updated to 24.1.0, however it does look like it’s still on Gramps Web API 1.5.0:

Gramps 5.1.6
Gramps Web API 1.5.0
Gramps.js 24.1.0
locale: en
multi-tree: false
task queue: true

Incidentally I also found in the docker-compose.yml file the tree is named: GRAMPSWEB_TREE=“Gramps Web” But I think I don’t need to know that since I can update Docker this way instead.

Still not seeing that Gramps Web API version 1.5.1 though and unsure how to update to that. Let me know what I’m doing wrong. Sorry for the basic questions!

Hi,

good point, upgrading wasn’t documented, I added that now, although you already found out.

https://www.grampsweb.org/Update/

Not sure why you don’t see 1.5.1, maybe the grampsweb image did not pick up the release yet, I rebuilt it manually now, please try again.

Hm I see the 1.5.1 release but it doesn’t seem like it’s picking it up:

root@grampsweb0222onubuntu2004-s-1vcpu-1gb-amd-sfo3-01:/opt/grampsweb# docker ps
CONTAINER ID   IMAGE                                     COMMAND                  CREATED          STATUS          PORTS                                                                      NAMES
a5a08ccad306   ghcr.io/gramps-project/grampsweb:latest   "/docker-entrypoint.…"   25 seconds ago   Up 24 seconds   5000/tcp                                                                   grampsweb
e9cb646139d4   ghcr.io/gramps-project/grampsweb:latest   "/docker-entrypoint.…"   31 seconds ago   Up 30 seconds   5000/tcp                                                                   grampsweb_celery
32ff2e6330ba   nginxproxy/acme-companion                 "/bin/bash /app/entr…"   34 seconds ago   Up 33 seconds                                                                              nginx-proxy-acme
c18603627f06   nginxproxy/nginx-proxy                    "/app/docker-entrypo…"   35 seconds ago   Up 34 seconds   0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp   nginx-proxy
b2047b72e898   redis:alpine                              "docker-entrypoint.s…"   35 seconds ago   Up 34 seconds   6379/tcp                                                                   grampsweb_redis
root@grampsweb0222onubuntu2004-s-1vcpu-1gb-amd-sfo3-01:/opt/grampsweb# docker-compose pull
Pulling grampsweb        ... done
Pulling grampsweb_redis  ... done
Pulling grampsweb_celery ... done
Pulling proxy            ... done
Pulling acme-companion   ... done
root@grampsweb0222onubuntu2004-s-1vcpu-1gb-amd-sfo3-01:/opt/grampsweb# docker-compose up -d
grampsweb is up-to-date
nginx-proxy is up-to-date
grampsweb_redis is up-to-date
nginx-proxy-acme is up-to-date
grampsweb_celery is up-to-date
root@grampsweb0222onubuntu2004-s-1vcpu-1gb-amd-sfo3-01:/opt/grampsweb# docker ps
CONTAINER ID   IMAGE                                     COMMAND                  CREATED          STATUS          PORTS                                                                      NAMES
a5a08ccad306   ghcr.io/gramps-project/grampsweb:latest   "/docker-entrypoint.…"   43 seconds ago   Up 43 seconds   5000/tcp                                                                   grampsweb
e9cb646139d4   ghcr.io/gramps-project/grampsweb:latest   "/docker-entrypoint.…"   49 seconds ago   Up 48 seconds   5000/tcp                                                                   grampsweb_celery
32ff2e6330ba   nginxproxy/acme-companion                 "/bin/bash /app/entr…"   52 seconds ago   Up 52 seconds                                                                              nginx-proxy-acme
c18603627f06   nginxproxy/nginx-proxy                    "/app/docker-entrypo…"   53 seconds ago   Up 52 seconds   0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp   nginx-proxy
b2047b72e898   redis:alpine                              "docker-entrypoint.s…"   53 seconds ago   Up 53 seconds   6379/tcp                                                                   grampsweb_redis

In the UI, the version number of the Gramps Web API seems the same:

Gramps 5.1.6
Gramps Web API 1.5.0
Gramps.js 24.1.0
locale: en
multi-tree: false
task queue: true

I did a --force-recreate and that didn’t do it. Do I need to prune the older images? Or is there something else I should be doing?

Oh, I’m really sorry. I forgot the grampsweb image will only pick up the latest Web API version when a new frontend is released. That will happen in around 4 hours… just need to write the release note. In the meantime, you could try latest-devel (but that uses the development branch always).

1 Like

Beautiful, this fixed it! Thank you DavidMStraub and now I know how to update docker so I can stick with the upstream. Learn something new every day hehe.

1 Like