calcom / docker

The Docker configuration for Cal.com is an effort powered by people within the community. Cal.com, Inc. does not provide official support for Docker, but we will accept fixes and documentation. Use at your own risk.
MIT License
646 stars 338 forks source link

Problems keeping connection with Google Calender #290

Open chriscroome opened 11 months ago

chriscroome commented 11 months ago

Users of a cal.com instance I have running have reported that:

Google Calender doesn’t seem to check availabillity or send me calender invites. Whenever I log-in to our hosted cal.com it says the permission for google cal have been revoked so I’ve just turned it off for now and will have to do manually until we find a solution.

And:

Go to my calendar and none of my appointments are in there. image

I'm updating the Docker container using:

#!/usr/bin/bash

set -a || exit
cd ~/calcom-docker || exit
source .env || exit
set +a || exit
printenv || exit
docker compose down || exit
git pull || exit
git submodule update --remote --init || exit
docker compose up -d database || exit
DOCKER_BUILDKIT=0 docker compose build calcom || exit
docker compose up -d || exit

This does report this issue, which might be related, when running the above script:

@calcom/prisma:db-deploy: No pending migrations to apply.

 Tasks:    1 successful, 1 total
Cached:    0 cached, 1 total
  Time:    6.747s 

📲 Updated app: 'apple-calendar'
📲 Updated app: 'caldav-calendar'
Error adding google credentials to DB: Unexpected end of JSON input
📲 Updated app: 'jitsi'
📲 Updated app: 'wipe-my-cal'
📲 Updated app: 'make'

Does anyone have any suggestions regarding what the cause of this might be and how to debug / fix it?

krumware commented 11 months ago

Are you running multiple instances with the same credentials? Can you share a de-identified token example from your env/config vars in your orchestrator?

chriscroome commented 11 months ago

Thanks @krumware there was an additional container running:

docker ps
CONTAINER ID   IMAGE                                   COMMAND                  CREATED       STATUS                   PORTS                                                 NAMES
73884e4a8349   calcom.docker.scarf.sh/calcom/cal.com   "docker-entrypoint.s…"   3 hours ago   Up 3 hours (unhealthy)   3000/tcp, 0.0.0.0:5555->5555/tcp, :::5555->5555/tcp   calcom-docker-studio-1
8bd814b99bf0   calcom.docker.scarf.sh/calcom/cal.com   "docker-entrypoint.s…"   3 hours ago   Up 3 hours (healthy)     0.0.0.0:3000->3000/tcp, :::3000->3000/tcp             calcom-docker-calcom-1
b86ea0474f25   postgres                                "docker-entrypoint.s…"   3 hours ago   Up 3 hours               5432/tcp                                              database

I have now commented out the studio image so there is is now:

docker ps
CONTAINER ID   IMAGE                                   COMMAND                  CREATED         STATUS                   PORTS                                       NAMES
730105128d05   calcom.docker.scarf.sh/calcom/cal.com   "docker-entrypoint.s…"   3 minutes ago   Up 3 minutes (healthy)   0.0.0.0:3000->3000/tcp, :::3000->3000/tcp   calcom-docker-calcom-1
03c265ad42b9   postgres                                "docker-entrypoint.s…"   3 minutes ago   Up 3 minutes             5432/tcp                                    database

The .env file contains:

GOOGLE_API_CREDENTIALS='{"web":{"client_id":"XXX.apps.googleusercontent.com","project_id":"example","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"XXX","redirect_uris":["https://example.org/api/integrations/googlecalendar/callback","https://example.org/api/auth/callback/google"]}}'

Is that the env var you were asking about?

krumware commented 11 months ago

The studio image shouldn't have caused it, since it runs a different process in the image. My thought was maybe Google was preventing two or more instances from using the same credentials.

On the env var, I've found in some cases that wrapping the variable in quotes or single quotes causes a parsing error on some containers, depending on the underlying OS. Try removing the wrapping single quotes and see if that helps with the error

chriscroome commented 11 months ago

I'm afraid a user has reported the issue again today:

Calendar has unsynced again. Showing me as available when I’m not. Log in. Go to Settings / Apps/Installed Apps and the message is there " Something went wrong.

Google Calendar: Try reconnecting your calendar with all necessary permissions". No alerts to my inbox or when I log into CalCom.

The error is only apparent when I go through Settings/Apps/Installed Apps as above.

Someone did try and book me today when I wasn’t available. Presumably will be in the back end, but that’s a rejected conversation. Didn’t see the request until after it had passed.

@krumware do you have any suggestions regarding how we could try to debug and fix this problem?