Debugging connection issue with Gramps Web Sync on Mac

[MacOS Sonoma 14.1.1, Gramps 5.1.6, Gramps Web API 1.5.0, Gramps.js 23.12.0]

Hi,

I am running Gramps Web using Docker Compose on a Linux Ubuntu server. Gramps Web appears to work fine.

After downloading and installing the default app package for Gramps on Mac OS and installing the Gramps Web Sync Add-On, I try to connect to the web server using owner credentials but get the error message “Error connecting to server” without further details.

  • The complete URL to base server, username, and password are correct.
  • Using the wrong password yields the same error message.
  • I find no entries in the Mac Console app.

The request does not appear to reach the Gramps Web server as there are

  • No entries in the Apache2 error or access log.
  • No entries in the docker logs (docker-compose logs).

I would be most grateful if anybody has a tip on how to debug the connectivity issue.

Specifically, I wonder how to get more information out from the local Gramps app running on my Mac. Is there a way to debug Add-Ons to see why the connection fails?

I guess one option would be to run Gramps from the command line, but I was hoping to use the default App package…

@emyoulation - thanks for the edit!

When starting the Mac OS Gramps app without command parameters, the documentation states that logs at the WARNING level should be printed.

It would appear that the error reported in the Gramps Web Sync plugin is not logged as a WARNING as no log output appears… :frowning:

Anyone knows the correct LOGGER_NAME to get log output for the Gramps Web Sync add-on when using the the --debug=LOGGER_NAME switch?

1 Like

Here’s the intro to the Gramps logfile article in the wiki:

A fresh Log file is created for each worksession in the application. (This overwrites any previous log since it uses the same name.) A file named Gramps51.log is created in the Gramps User Directory.

(The path differs by OS.) It is a plain text file.

PS: this was this 1st time I’ve found to use Discourse’s linkify terms feature for the logfile

Thanks!

From the Logging system wiki page:

The name of the root logger is an empty string, thus e.g. --debug=“” will enable all debug logs.

Using this switch makes Gramps spew out debug logs as expected, but still no joy for the Gramps Web Sync add-on. In fact, running the add-on produces no log output at all.

To me, this starts to look like a bug and not user error…

Any ideas on how to debug the connectivity issue? Should I log a bug report?

This is a screenshot of the add-on’s screen:

image

As this is a Gramps Web issue and its creator @DavidMStraub is currently the only person experienced enough to do support, let’s wait for him to weigh in. (Reasonably, the holidays might cause a bit of delay.)

It’s hard to say if all the settings are correct; unfortunately the exact error is currently not logged, but you could manually add a log statement where the error is handled in the code (except URLError).

How would a neophyte add a “log statement”?

@Nick-Hall , @prculley , @SNoiraud : This could be a good reference example for how to properly add Debugging gramps51.log functionality to a module that already has GUI error reporting but no actionable tracelog. (“Properly” as in recognizing the --debug command line to output in-depth info only when desired. And when running normally, not impact normal processing load with excessive logging.)

Commenting to follow as I am also experiencing this issue and not sure how to document the exact error. I ran this with the following command:

/Applications/Gramps.app/Contents/MacOS/Gramps --debug=""

And when I went to run web sync, I got the same error described above and I did not see anything in the terminal.

I’m not a developer and may be doing things incorrectly here :innocent:

I have the same problem with Gramps 1.5.6 on MacOS 14.3 Sonoma and Webgramps. With Gramps 1.5.6 on Windows 10 (VM on the very same Mac) the synchronization works flawlessly. So I guess it is a problem with the sync plugin on MacOS.

Neophyte or not, I am actually a developer, just not very experienced in Python and specifically I don’t know Gramps. Tried to get the a developer environment running but in the end it turned out to be too much of hassle… else I would have submitted a patch.

Instead I will just do some very simple dry-coding. :slight_smile:

The error message can be matched to line 429 where the root cause is swallowed and not communicated to the user. This should be fixed by updating the statement to something like:

self.handle_error(_("Error connecting to server: %s") % exc.reason)

In addition, the suggestion by @emyoulation of using this as an example on where to add proper logging, sounds like an excellent idea.

In my opinion, each step of the synchronisation process should be traced at debug level where some key steps are logged at info level. For generic, top level exceptions like the URLError on line 429 you might also consider logging the traceback, as it could shed additional light to what the error actually is, if not evident from the reason property.

My five cents, and as said, would have been happy to submit a patch, if only it had been easier to get a local environment up and running.

2 Likes

Happy to take another swing at this if anyone has a step by step way to do it. I do love Gramps web terminal but I wonder if using the full desktop version would allow me do some things I can’t do in the web app.

@emyoulation @DavidMStraub @kenhara
I hate to disturb you all but as a newbie to Gramps and Grampsweb, I am reaching out to you as I have trouble installing the sync add on.
I have a Mac running on Sonoma.
I downloaded " gramps-web-sync-main " file with .py files and a Po folder but am unable to install it.
I tried using the Terminal (totally not my area of expertise) and can’t get anywhere.
Basically I just want to continue to use Grampsdesktop and get my page on GrampsHub updated.
Thanks a lot.

Hi @Tjuder, the Gramps Web Sync Addon is in the official Gramps Addon repository, so the installation process is the same as for any other addon, see 5.1 Addons - Gramps or Synchronize with Gramps - Gramps Web.

While that answers the question how to install it, unfortunately the problem that the addon does not currently work on MacOS (see above or gamps-web-sync doesn't work on MacOS · Issue #26 · DavidMStraub/gramps-web-sync · GitHub) is not solved yet.

Would somebody among the Mac users be willing to try out adding additional log statements to the addon source to try to track down the issue? I don’t own a :apple: device.

You have to locate the file webapihandler.py and then you can just sprinkle logging statements all over the place. I’ll be happy to use the outcome of that exercise to debug the error.

EDIT: to be clear, what I mean is not necessarily contributing improved logging to the actual addon, but simply adding this manually to your local copy of the addon.

Understood. Many thanks.
In this case, could you please explain if and how I can manually sync by uploading newer versions of the tree from Gramps Desktop.
And the reverse process… meaning how to update the tree on my local Gramps Desktop once additions have been made online by my registered users.
Sincerely appreciate your replies.

Hi,
synchronization is not a trivial process, and the sync addon is exactly what is needed to achieve it, so there is no reasonable alternative.

However, a different users has just reported here that the Sync Addon does work on MacOS, so please install it following the guide above and let us know here whether you encounter any issues.

Hello David,
I’m now running Gramps 5.2.0 on
Mac OS Sonoma 14.3.1
I am trying to sync Gramps on Grampshub but I get the “Error connecting to server” message.



Any solution, please?
Thanks

Hi there.
As I’m experiencing the same issue, I wondered if you found a solution to this.
Thanks for any feedback / solution.

Hi,

Grampshub is stilling running Gramps 5.1. Gramps Web for 5.2 was only released two days ago; same for a new version of the sync addon that should address connection issues on Mac OS (Update to Gramps Web Sync Addon to 1.1.1 by DavidMStraub · Pull Request #591 · gramps-project/addons-source · GitHub), but it targets Gramps 5.2. Please wait a couple of days until the dust settles.

Thanks David.
Just my feedback on how I managed to get the sync work!
Went to list of plug-ins on Gramps Desktop.
Searched for the Sync plug-in.
Updated to the new version.
This time no problem at all.
Now, just waiting for GrampsWeb to stop showing Error 500 when I want it to show the individuals list.