T
Twenty2mo ago
Andreas

Google apis auth is not enabled

Hi everyone, I have an issue with connecting Google calendar & mail. I've enabled the People API, Mail and Calendar APIs as well as added the URIs in the project. When checking the docker log for twenty-server-1 I see the following: Exception Captured { user: { id: '5ecb56b6-dc78-4ce7-98cf-3bf43b44dc4a' }, workspace: { id: 'aa11a739-2652-4c22-91bd-97ea393cc5fb' } } [ AuthException [Error]: Google apis auth is not enabled at GoogleAPIsOauthRequestCodeGuard.canActivate (/app/packages/twenty-server/dist/src/engine/core-modules/auth/guards/google-apis-oauth-request-code.guard.js:44:19) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async GuardsConsumer.tryActivate (/app/node_modules/@nestjs/core/guards/guards-consumer.js:16:17) at async canActivateFn (/app/node_modules/@nestjs/core/router/router-execution-context.js:134:33) at async /app/node_modules/@nestjs/core/router/router-execution-context.js:42:31 at async /app/node_modules/@nestjs/core/router/router-proxy.js:9:17 at async /app/node_modules/@nestjs/core/router/router-explorer.js:166:17 { code: 'GOOGLE_API_AUTH_DISABLED' } ] This is my .env: MESSAGING_PROVIDER_GMAIL_ENABLED=true CALENDAR_PROVIDER_GOOGLE_ENABLED=true AUTH_PASSWORD_ENABLED=false AUTH_GOOGLE_APIS_CALLBACK_URL=http://server-ip:3002/auth/google-apis/get-access-token AUTH_GOOGLE_ENABLED=true AUTH_GOOGLE_CLIENT_ID=xxx-yyy.apps.googleusercontent.com AUTH_SSO_ENABLED=true AUTH_GOOGLE_CLIENT_SECRET=GOCSPX-xxxxx AUTH_GOOGLE_CALLBACK_URL=http://server-ip:3002/auth/google/redirect Any ideas? I've also tried running the cron jobs from the documentation.
17 Replies
thomast
thomast2mo ago
cc @Raphaël
Andreas
AndreasOP2mo ago
@thomast @Raphaël any ideas? 🙂
Raphaël
Raphaël2mo ago
Hello @Andreas, I'm taking a look at your issue 🙂 This error happens only when MESSAGING_PROVIDER_GMAIL_ENABLED or CALENDAR_PROVIDER_GOOGLE_ENABLED is set to false. Did you update the .env both in your worker and your server? Could you double check that you did every step in https://twenty.com/developers/section/self-hosting/setup#setup-messaging-&-calendar-sync correctly? If the error persists we can take a look at it together
Andreas
AndreasOP2mo ago
Hmm, how do you mean .env in worker and server? How do I access those? 🤔 @Raphaël
thomast
thomast2mo ago
can you run docker exec <container_id> env
Raphaël
Raphaël2mo ago
I remember one self hoster had the problem where he had two .env files, one for the server and one for the worker, and he set these variables only in one of these. If you did the one click config, you should only have one
Andreas
AndreasOP2mo ago
root@ubuntu-etc-server:~/projects/twenty/twenty# docker exec twenty-worker-1 env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOSTNAME=e868db691ee5 STORAGE_S3_NAME= APP_SECRET=hashedpw FRONT_BASE_URL=http://serverip:3002 REDIS_URL=redis://:hashedpw@redis:6380 ENABLE_DB_MIGRATIONS=false PG_DATABASE_URL=postgres://twenty:twenty@db:5432/default SERVER_URL=http://serverip:3002 STORAGE_S3_REGION= STORAGE_TYPE=local STORAGE_S3_ENDPOINT= NODE_VERSION=18.17.1 YARN_VERSION=1.22.19 REACT_APP_SERVER_BASE_URL= SENTRY_RELEASE= HOME=/home/node root@ubuntu-etc-server:~/projects/twenty/twenty# docker exec twenty-server-1 env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOSTNAME=fea9cd8c45f7 PORT=3000 STORAGE_S3_ENDPOINT= STORAGE_S3_NAME= SERVER_URL=http://server-ip:3002 SIGN_IN_PREFILLED=false FRONT_BASE_URL=http://server-ip:3002 STORAGE_TYPE=local REDIS_URL=redis://:hashedpw@redis:6380 APP_SECRET=hashedpw ENABLE_DB_MIGRATIONS=true STORAGE_S3_REGION= PG_DATABASE_URL=postgres://twenty:twenty@db:5432/default NODE_VERSION=18.17.1 YARN_VERSION=1.22.19 REACT_APP_SERVER_BASE_URL= SENTRY_RELEASE= HOME=/home/node Hmm you're correct I think @Raphaël? I followed the one click guide though. What would you suggest as next step to resolve?
Raphaël
Raphaël2mo ago
@charles
charles
charles2mo ago
@Andreas In order to add an env variable to your containers, you'll need to: - add them to your env variable in the docker-compose.yml - (optional) docker-compose can refer to .env file so you might also want to add them to .env and refer to them from docker-compose.yml
Andreas
AndreasOP2mo ago
@charles hmm ok so I simply add MESSAGING_PROVIDER_GMAIL_ENABLED=true & CALENDAR_PROVIDER_GOOGLE_ENABLED=true in the docker-compose.yml?
Weiko
Weiko2mo ago
@Andreas yes or as suggested by @charles you can use your env variables and add to the docker-compose.yml
MESSAGING_PROVIDER_GMAIL_ENABLED=${MESSAGING_PROVIDER_GMAIL_ENABLED}
CALENDAR_PROVIDER_GOOGLE_ENABLED=${CALENDAR_PROVIDER_GOOGLE_ENABLED}
MESSAGING_PROVIDER_GMAIL_ENABLED=${MESSAGING_PROVIDER_GMAIL_ENABLED}
CALENDAR_PROVIDER_GOOGLE_ENABLED=${CALENDAR_PROVIDER_GOOGLE_ENABLED}
and update the .env with the corresponding values
Andreas
AndreasOP2mo ago
Hey! Seems to have solved the problem 🙌 if I want to check the logs to see that the mail sync is working as it should, where do I find it?
Raphaël
Raphaël2mo ago
You can look at them inside the twenty-worker-1 logs 🙂
Andreas
AndreasOP2w ago
@charles - may I ask you regarding this? I finally got around to setup SSL for my twenty self hosting. When I check docker logs for twenty-worker-1 it doesn't seem like there are any entries for the gmail sync. But it shows "Importing" in the UI. I ran these as well but log doesn't show anything still. docker exec -it twenty-worker-1 sh -c " yarn command:prod cron:messaging:messages-import && yarn command:prod cron:messaging:message-list-fetch && yarn command:prod cron:calendar-event-list-fetch && yarn command:prod cron:calendar-events-import && yarn command:prod cron:messaging:ongoing-stale && yarn command:prod cron:ongoing-stale" Do you know what the issue could be?
No description
Andreas
AndreasOP2w ago
Also if it's more convenient we could jump on a call 🙂
thomast
thomast2w ago
do you see any errors in your worker logs?
charles
charles2w ago
Let's address this during our call today too

Did you find this page helpful?