MarcelRobitaille / nextcloud_google_synchronization

🇬 Google integration into Nextcloud
GNU Affero General Public License v3.0
18 stars 1 forks source link

Can import Google calendar, but not sync #8

Open janaxhell opened 1 year ago

janaxhell commented 1 year ago

I'm on v25.0.6 inside AIO. My domain passes through Nginx Proxy Manager. I have setup the Google Synchronization following this video then I moved to Personal Settings and connected to my Google account.

I can import everything, but cannot sync. After importing, Nextcloud calendar populated with all Google events, but when I tried to add a couple of new test events to Google, they did not sync to Nextcloud. When I instead clicked Import again, they appeared.

The logging is full of these errors repeated over and over https://pastebin.com/9SRWmdSz

As a side note, I cannot sync from DAVx5 app either, despite permission granted from Nextcloud android app. So my Nextcloud can see and import the contents of my Google account, but not sync. What's wrong?

Doing more tests, I can now sync between

Nextcloud <---> DAVx5 <---> Simple Calenader

but not Google Calendar in any direction, only import

lroyb commented 9 months ago

if you read the markdown file, it says that it is a fork of the 'google intergration' app. Most importantly it says that ' it should not be used as well as'. So, I disabled the google intergration app, leaving the google Synchronization app enabled. and it worked first try afterward.

janaxhell commented 9 months ago

I posted this 4 months ago, I have updated NC several times since and i'm on Nextcloud Hub 5 (27.0.2). As of now I cannot find Google Integration anywhere, but DAVx5 and Google Synchronization still give errors all the time like this

Failed to get number of Google photos: "ServerException|ClientException, message:Client error:GET https:\/\/photoslibrary.googleapis.com\/v1\/albums?pageSize=50resulted in a401 Unauthorizedresponse:\n{\n \"error\": {\n \"code\": 401,\n \"message\": \"Request had invalid authentication credentials. Expected OAuth 2 access (truncated...)\n status code: 401"

I got tired and just ignore it.

lroyb commented 9 months ago

By the look from the above message, have you created the oauth2 app with the correct Google api's enabled. Then successfully logged into your Google account through nextcloud, which you can then give nextcloud access to the oauth2 app?

janaxhell commented 9 months ago

Of course, but it periodically forgets about it and wants to grant access again. That is so annoying I gave up.

MarcelRobitaille commented 4 months ago

Hi everyone. Sorry I haven't been around. For some reason, even though I own this fork, it was not set up to send me notifications on issues and PRs. Sorry about that! I've signed up now.

Sorry you are experiencing this issue. I will look into it.

MarcelRobitaille commented 4 months ago

Could you please try the latest release and let me know if you are still experiencing this.

janaxhell commented 4 months ago

@MarcelRobitaille

Hi, I have just installed and tried the latest version available. This is what happened:

No error message from Google, but now I have Nextcloud Calendar populated with tons of wrong duplicate events. The events with double entries cyan/blue in the picture have the wrong time in the cyan block and right time in the blue block.

image

EDIT Sorry, my bad: all the cyan blocks are from Baikal service, which for some reason set the wrong time. But this also means that neither Sync nor Import had any effect toward my Gmail account. Nothing has been synced nor imported from there.

MarcelRobitaille commented 4 months ago

@janaxhell what happens when you press the import button? Are there any logs you could share?

janaxhell commented 4 months ago

I use Nextcloud AIO, from which service do you want me to check the logs?

nextcloud-aio-apache nextcloud-aio-collabora nextcloud-aio-database nextcloud-aio-fulltextsearch nextcloud-aio-imaginary nextcloud-aio-mastercontainer nextcloud-aio-nextcloud nextcloud-aio-notify-push nextcloud-aio-redis

The nextcloud-aio-nextcloud service is showing right now this:

2024-02-29 17:29:55 Importing it.italian#holiday@group.v.calendar.google.com... done. Added 
2024-02-29 17:29:56 Importing XXXXXX@XXXXXX... done. Added 0
2024-02-29 17:30:08 Importing XXXXXX@XXXXXX... done. Added 
2024-02-29 17:34:55 Importing XXXXXX@XXXXXX... done. Added 0
2024-02-29 17:34:59 Importing XXXXXX@XXXXXX... done. Added 
2024-02-29 17:34:59 Importing it.italian#holiday@group.v.calendar.google.com... done. Added 
2024-02-29 17:39:55 Importing XXXXXX@XXXXXX... done. Added 0
2024-02-29 17:39:59 Importing it.italian#holiday@group.v.calendar.google.com... done. Added 
2024-02-29 17:39:59 Importing XXXXXX@XXXXXX... done. Added 
2024-02-29 17:44:55 Importing XXXXXX@XXXXXX... done. Added 0
2024-02-29 17:44:58 Importing it.italian#holiday@group.v.calendar.google.com... done. Added 
2024-02-29 17:44:59 Importing XXXXXX@XXXXXX... done. Added 
2024-02-29 17:50:04 Importing it.italian#holiday@group.v.calendar.google.com... done. Added 
2024-02-29 17:50:04 Importing XXXXXX@XXXXXX... done. Added 0
2024-02-29 17:50:08 Importing XXXXXX@XXXXXX... done. Added 
2024-02-29 17:54:55 Importing it.italian#holiday@group.v.calendar.google.com... done. Added 
2024-02-29 17:54:55 Importing XXXXXX@XXXXXX... done. Added 0

but in the NC GUI I haven't enabled the Sync thick for holiday/festivity, only my own gmail address.

MarcelRobitaille commented 4 months ago

Thank you for the logs. Just to be very clear because it's hard to tell from your language:

Please press this button: image

You should see something like this in the top right: image

For me, everything is up to date, so I see '0 events successfully imported". You can think of the button "Sync calendar" as automatically pressing "Import calendar" every 5 minutes. "Import calendar" is easier to troubleshoot, so that's why I want to see if it works first.

janaxhell commented 4 months ago

Yes, that appears to me as well and the first time I did it today I saw a number different from zero, like 24 events added:

image

But it is incoherent with what I see:

image

On the left side panel you see that Personal (= my gmail account) is blue and Baikal (external caldav) is cyan. When I Import from gmail, I see cyan blocks being added instead of the blue ones. I have configured Google Sync to use my gmail account, not Baikal, that's to sync the calendar on my phone. Maybe I should completely clear Nextcloud calendar and try gain from scratch, but I'm going offline now and won't be able to try again before tomorrow afternoon.

MarcelRobitaille commented 4 months ago

Thanks for the updates. That's weird. It should create a dedicated calendar for each calendar you sync from google. You should have a new calendar blah@google.com. It should not modify Personal or Baikal at all. If it does, that's very bad.

Could you please press the "Delete all background jobs" button in the admin page?

janaxhell commented 4 months ago

Deleted all background jobs, then I have deleted all my calendars and also had to logout/login to my Google account (prior to that I could import 0 events). I have been able to Import my calendar, but I confirm that all events created before Legal/Solar time last october are set 1 hour earlier than the correct one. Sync works correctly, but I wonder what time will it set at the end of march when we'll have again Legal/Solar time change.

MarcelRobitaille commented 4 months ago

So everything works correctly except for dailight savings time? Is it possible your nextcloud locale / time zone settings are misconfigured?

janaxhell commented 4 months ago

No, because everything else is ok and the calendar events too showed the correct time when I first imported them many months ago. Also, new test events that I have created are synced with the correct time, now that I am in the same time window. I have checked right now, and the events time is wrong from OCT 31 2023 (included) which is exactly the first date after the Legal/Solar time change. I have created the events for my university lessons before that date covering the entire year (on Google calandar), so the dates and times are cloned for all of them. But as you can see from the pictures, in NC they are shown 1 hour earlier. If the locale was wrong, they would be either all wrong, or all right. But they are not across Solar/Legal time change.

vivaldi_NDMT6e8MZJ

vivaldi_zOhx6ZUybb

Also, now that I'm looking at the pictures, the LINGUA GIAPPONSE 1 event on Wednesday present in the NC calendar does not exist in the Google Calendar, so I have no idea where that has been imported from.

MarcelRobitaille commented 4 months ago

Thanks for the update. Is it a recurring event in Google Calendar or is each event entered individually? Could you please let me know which time zone you have selected in Google and in Nextcloud?

If it's not too much trouble, could you please uninstall this app and install https://github.com/nextcloud/integration_google to see if the issue also occurs there?

janaxhell commented 4 months ago

I've set a few events in the first week, then set them to repeat every week until X. In Google Calendar I've set GMT+1 and I have supposedly set the same in NC, but I cannot find that setting anywhere, I have disabled Google Synchronization and Installed Google Integration (that's all I can find in the Apps menu), but the version number does not match the one in the github you linked: github = 1..0.9, Nextcloud = 2.1.0. Nevertheless if I click Visit Website in the app details tab, I'm brought to the same github page thats shows v 1.0.9. This is quite confusing. Also now I cannot see any entry in the admin column to connect to Google.

MarcelRobitaille commented 4 months ago

That is weird. This app is a fork of that one. The settings should mostly be the same.

About the versions, probably they just did not release the latest version yet. Don't worry about it, not much has changed.

MarcelRobitaille commented 4 months ago

The time zone should be here (don't ask me why) image

The reason I'm asking so much about time zones is that all of the backend should be in UTC. It does not care about time zones or daylight savings or anything like that. It's up to the calendar app to read the UTC time from the database and display it properly.

GMT+1

This is very interesting. GMT does not observe daylight savings as far as I know. The UK uses GMT only in the winter. They use BST (British summer time) in the summer. Could you please try setting your time zone in Google and Nextcloud to "Europe - Rome"?

If Nextcloud is set up to use daylight savings (like "Europe - Rome") and Google is not (GMT+1), this could be the cause of the shift.

janaxhell commented 4 months ago

Thanks, NC is set as Europe - Rome, Google Calendar is set as Primary time zone = (GMT+01:00) Central European Time - Rome. I cannot see any option to set in a different way than GMT+x, there is no "Europe - Rome" entry .

image

This is very interesting. GMT does not observe daylight savings as far as I know. The UK uses GMT only in the winter.

I'm not sure about Google Calendar, but many devices/app that are set to GMT often show GMT+2 in summer.

MarcelRobitaille commented 4 months ago

Ok, I am able to reproduce this with those timezone settings. I will take a look.

MarcelRobitaille commented 4 months ago

@janaxhell Are you the owner of the Google Calendar? You might be better served by importing it a different way (please see the disclaimers I added to the readme)

janaxhell commented 4 months ago

I won't be able to check this before the weekend, I'm commenting just to let you know I've not disappeared.

janaxhell commented 3 months ago

Here I am. Of course I am the owner of the calendar, I don't understand the rest of your post: why would I want to synchronize from NC to Google? Or is the ical method a workaround for the wrong event-times?

My scenario is: I want to move out from Google, but until I haven't found a reliable combination of apps and services to replace it (*), I prefer keeping both Google and NC. So I'd like to have a way to sync anything that I add to Google -> to Nextcloud. And then at some point get rid of Google.

(*) mostly because so far in NC there still isn't a real working Tasks feature nor import function.

EDIT I have imported using the ical method, looks fine. In the Google data migration tab there is no Sync Calendar button, only Import (which still imports with the wrong times).

MarcelRobitaille commented 3 months ago

Hi. If you are the owner, there may be an easier way. What I described earlier is a different method to synchronize Google to Nextcloud, not a method to sync Nextcloud to Google. I have tested it on my side. I am able to reproduce your bug with this app, but the other method I described shows the time properly.

Here are the steps for the ical method. Sorry for not explaining it well earlier:

  1. In the Google Calendar, click the 3 dots next to the calendar you want to import and go to settings.
  2. Scroll down until the "Secret address in iCal format" and copy it
  3. In Nextcloud Calendar, click "New calendar" and click "New subscription from link (read only)". Paste the secret link from before

I originally made this fork because the calendar I wanted to sync was owned by a team. I did not have access to get the private address. That's the advantage of this app over the ical method.

I'm not very familiar with Google Tasks, but Nextcloud Tasks seems good enough for me. If you assign a due date to a task, it will show up in your calendar. What are you trying to import? Tasks?

Regarding the edit:

In the Google data migration tab there is no Sync Calendar button, only Import Is it possible you have an app called "Google Integration" installed (from which this app is forked)? which still imports with the wrong times Interesting. For me it's working. Is it possible you're using the "Google Integration" app instead of the ical method?

janaxhell commented 3 months ago

Here are the steps for the ical method.

I already did that and it imported correctly. I cannot sync.

In the Google data migration tab there is no Sync Calendar button, only Import

Is it possible you have an app called "Google Integration" installed (from which this app is forked)? which still imports with the wrong times Interesting. For me it's working. Is it possible you're using the "Google Integration" app instead of the ical method?

I had Google Synchronization at the beginning of this conversation, then you told me:

If it's not too much trouble, could you please uninstall this app and install https://github.com/nextcloud/integration_google

So since then I have always used Google Integration.. Which does not appear in the Admin menu. Should I replace it back?

If it's not possible to synchronize with correct time, I suppose I'll just stay with Import and when it's possible to have a full monolithic Google Calendar+Tasks replacement, I'll move to that.

I'm not very familiar with Google Tasks, but Nextcloud Tasks seems good enough for me.

It's not at all for me: it doesn't show tasks in calendar despite having it enabled to do so and it doesn't allow to set periodical/repeated events, I am trying jtxBoard for that, but it's only from phone, not convenient being mostly at my desktop. Google Tasks is so easy: I just click any point on the Calendar, choose Task and set it as I wish. Nextcloud has a byzantine interface for Tasks.

MarcelRobitaille commented 3 months ago

I already did that and it imported correctly. I cannot sync.

As far as I know, that method should also keep it up to date. What do you mean you cannot sync.

I had Google Synchronization at the beginning of this conversation, then you told me:

If it's not too much trouble, could you please uninstall this app and install https://github.com/nextcloud/integration_google

Oh yea, I did tell you to do that, didn't I. Sorry about that.

Yes, repeating tasks are a big pain in NC. I'm also subscribed to that GH issue.

janaxhell commented 3 months ago

Ahh, so you mean that using the ical link will work as IF I click on the Sync button (but with correct times)? So the best thing now is to reinstall Google Synchronization AND use the ical link method, right?

MarcelRobitaille commented 3 months ago

I think you don't need any Google Synchronization / Google Integration app at all. I think you only need the ical sync method

janaxhell commented 3 months ago

Ok, thank you for all the help!

janaxhell commented 3 months ago

Sorry, one last thing: I've just tried to add a TEST event to Google Calendar. How/when should it appear in NC Calendar? I don't see anything else than the secret ical link to set.. Is there a timeframe after which ical link is synced?

MarcelRobitaille commented 3 months ago

I'm not sure. I don't think it's configurable anywhere. At a guess, when your background jobs run.

Administration > Basic Settings image

janaxhell commented 3 months ago

Yes, you are right: in that section it says "Last job ran 3 minutes ago." and in fact while you were replying, the TEST event appeared in Nextcloud. Thanks again!

MarcelRobitaille commented 5 days ago

Sounds like it's resolved. Closing this.

janaxhell commented 5 days ago

No, it's not, I checked again several other times and it did not sync anymore. Cron job shows as fired X minutes ago, but calendar does not sync. I gave up. It's not a vital feature for me, too many problems. Thanks anyway.

MarcelRobitaille commented 5 days ago

@janaxhell Thanks for the feedback. A lot of problems were discussed in this thread. Can you please let me know what problem you are still experiencing?

janaxhell commented 5 days ago

It does not sync. It did last time we talked, it stopped doing so sometime in the middle. If I add an event to GC, it never appears in NC.

MarcelRobitaille commented 5 days ago

Can you please check in the admin settings that the background jobs are being run correctly?

janaxhell commented 5 days ago

"Secondi fa" means "a few seconds ago"

image

MarcelRobitaille commented 5 days ago

Very nice internationalization :laughing:

Sorry for asking the same questions again, but a lot of time passed and maybe something changed:

janaxhell commented 5 days ago

Very nice internationalization 😆

Sorry for asking the same questions again, but a lot of time passed and maybe something changed:

  • What version of the app are you using? Google integration Version 2.2.0

  • Could you please try pressing the button "Delete all background jobs" in "Connected accounts" and register the job again

As usual I had to disconnect from Google and reconnect. As I clicked "Import", it imported all the events. Anyway as far as I remember this had nothing to do with ICAL job, which should be a separate automation. In the end neither work after some time.