T
Twentyโ€ข4mo ago
Cosmos

Error 500 when connecting Gmail

Hi there. I'm getting an issue connecting my gmail. I'm wondering whether this is an .env problem, docker-compose problem, an API library problem, or bug in the application? I'm getting through to the google screens, but when I land back on the app I get an error 500. This is the URL in my browser: http://localhost:3000/auth/google-apis/get-access-token?state=%7B%22transientToken%22:%22eyJredacted.eyJzdWIiOiIzOWMyredactedloM%22%7D&code=4/0redactedw&scope=email%20profile%20https://www.googleapis.com/auth/userinfo.email%20https://www.googleapis.com/auth/userinfo.profile%20https://www.googleapis.com/auth/gmail.readonly%20openid&authuser=0&hd=redacted.com&prompt=consent Using docker-compose up -d my .env file:
TAG=v0.20.0

PG_DATABASE_HOST=db:5432

SERVER_URL=http://localhost:3000
# Uncoment if you are serving your front on another server than the API (eg. bucket)
# FRONT_BASE_URL=http://localhost:3000



SIGN_IN_PREFILLED=false

STORAGE_TYPE=local

# STORAGE_S3_REGION=eu-west3
# STORAGE_S3_NAME=my-bucket
# STORAGE_S3_ENDPOINT=

MESSAGE_QUEUE_TYPE=pg-boss
# === Randomly generated secrets ===
# Use openssl rand -base64 32 for each secret
ACCESS_TOKEN_SECRET=Zz..T1g=
LOGIN_TOKEN_SECRET=O..4=
REFRESH_TOKEN_SECRET=FV..w4=
FILE_TOKEN_SECRET=S..U=

POSTGRES_ADMIN_PASSWORD=Br..I=



FRONT_AUTH_CALLBACK_URL=${SERVER_URL}/verify

AUTH_PASSWORD_ENABLED=true
AUTH_GOOGLE_ENABLED=true
AUTH_GOOGLE_CLIENT_ID=5redacted.apps.googleusercontent.com
AUTH_GOOGLE_CLIENT_SECRET=GedactedG

AUTH_GOOGLE_CALLBACK_URL=${SERVER_URL}/auth/google/redirect
AUTH_GOOGLE_APIS_CALLBACK_URL=${SERVER_URL}/auth/google-apis/get-access-token

CALENDAR_PROVIDER_GOOGLE_ENABLED=true
MESSAGING_PROVIDER_GMAIL_ENABLED=true


EMAIL_SMTP_HOST=smtp.gmail.com
EMAIL_SMTP_PORT=465
EMAIL_SMTP_PASSWORD='re da ct ed'
TAG=v0.20.0

PG_DATABASE_HOST=db:5432

SERVER_URL=http://localhost:3000
# Uncoment if you are serving your front on another server than the API (eg. bucket)
# FRONT_BASE_URL=http://localhost:3000



SIGN_IN_PREFILLED=false

STORAGE_TYPE=local

# STORAGE_S3_REGION=eu-west3
# STORAGE_S3_NAME=my-bucket
# STORAGE_S3_ENDPOINT=

MESSAGE_QUEUE_TYPE=pg-boss
# === Randomly generated secrets ===
# Use openssl rand -base64 32 for each secret
ACCESS_TOKEN_SECRET=Zz..T1g=
LOGIN_TOKEN_SECRET=O..4=
REFRESH_TOKEN_SECRET=FV..w4=
FILE_TOKEN_SECRET=S..U=

POSTGRES_ADMIN_PASSWORD=Br..I=



FRONT_AUTH_CALLBACK_URL=${SERVER_URL}/verify

AUTH_PASSWORD_ENABLED=true
AUTH_GOOGLE_ENABLED=true
AUTH_GOOGLE_CLIENT_ID=5redacted.apps.googleusercontent.com
AUTH_GOOGLE_CLIENT_SECRET=GedactedG

AUTH_GOOGLE_CALLBACK_URL=${SERVER_URL}/auth/google/redirect
AUTH_GOOGLE_APIS_CALLBACK_URL=${SERVER_URL}/auth/google-apis/get-access-token

CALENDAR_PROVIDER_GOOGLE_ENABLED=true
MESSAGING_PROVIDER_GMAIL_ENABLED=true


EMAIL_SMTP_HOST=smtp.gmail.com
EMAIL_SMTP_PORT=465
EMAIL_SMTP_PASSWORD='re da ct ed'
No description
13 Replies
Cosmos
Cosmosโ€ข4mo ago
docker compose file
John
Johnโ€ข4mo ago
Perhaps those env vars also need to live on the worker? I have a similar setup locally (which is working) and the only difference seems to be the env vars on the worker container
Cosmos
Cosmosโ€ข4mo ago
I added it to the docker worker, still no luck... I've also confirmed the callback URLs in Google APIs
No description
Uranium
Uraniumโ€ข4mo ago
Hello, can you please send the Google and Gmail url inside your .env ?
Cosmos
Cosmosโ€ข4mo ago
http://localhost:3000/auth/google/redirect (AUTH_GOOGLE_CALLBACK_URL) http://localhost:3000/auth/google-apis/get-access-token (AUTH_GOOGLE_APIS_CALLBACK_URL) @Uranium
aficio
aficioโ€ข4mo ago
Not very sure about twenty architecture, but on other projects I have only been able to make external connections like this with a publicly reachable url (non localhost). better to be confirmed by someone that knows the codebase
charles
charlesโ€ข4mo ago
Hi @Cosmos, sorry for the very late reply. Are you still facing the issue? You are looking to sign up / sign in as a Gmail account or to connect your gmail inbox / calendar to Twenty once signed in. THose are two different features
Divyadeep Sawhney
Divyadeep Sawhneyโ€ข3mo ago
Hi @charles I am facing this issue as of now. I was just trying to connect my Gmail Inbox. I was able to get to a point where it's throwing Error 500 when it tries to redirect me to http://localhost:3000/auth/google-apis?transientToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI0MjhkNmU1Zi0xNjM0LTRmZjAtODcwZi1hNmI5M2ViNmYxZGEiLCJ1c2VySWQiOiI1NTdiODJlNC1jZjMyLTRkMDAtODg2My1hOGIwMjkxYmZhZjgiLCJ3b3Jrc3BhY2VJZCI6IjhkOTA5NDNlLTEyNzYtNDYzNC1iYWUwLWUxYjU2NmI0ZDc3MyIsImlhdCI6MTcyMjAyMjY3MSwiZXhwIjoxNzIyMDIyOTcxfQ.X6cmYNU6tcTZ3dBPnKq-wErrIDdqIOKQU75ivynqacI Here's my Env of docker container twenty-server: "Env": [ "SIGN_IN_PREFILLED=true", "STORAGE_S3_REGION=", "SERVER_URL=http://localhost:3000", "REFRESH_TOKEN_SECRET=DUa6E557/PRfJvT/xsFLcPYelRv4d6cC8IFx4a5xeww=", "LOGIN_TOKEN_SECRET=amnBbpzp7MTfJ9XhmrXpNA4UD4QCJyhNvxTopVSo4vw=", "FILE_TOKEN_SECRET=A4SKTl2hmsMvBazixPdCtTKC8+ksxuYxLX7iulM0IFc=", "PG_DATABASE_URL=postgres://twenty:twenty@db:5432/default", "FRONT_BASE_URL=http://localhost:3000", "STORAGE_S3_NAME=", "STORAGE_S3_ENDPOINT=", "MESSAGE_QUEUE_TYPE=pg-boss", "STORAGE_TYPE=local", "ACCESS_TOKEN_SECRET=SGkarixpyD8n8lrQKv1Jm4kDk7EyOb8155TPEEXIz9I=", "PORT=3000", "CALENDAR_PROVIDER_GOOGLE_ENABLED=true", "MESSAGING_PROVIDER_GMAIL_ENABLED=true", "ENABLE_DB_MIGRATIONS=true", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "NODE_VERSION=18.17.1", "YARN_VERSION=1.22.19", "REACT_APP_SERVER_BASE_URL=", "SENTRY_RELEASE=" ],
Yazane
Yazaneโ€ข3mo ago
I have the same issue, any ideas ?
๐—ป๐—ถ๐—ฐ๐—ผ๐—น๐—ฎ๐˜€
@Yazane, if you haven't resolved this yet, I recommend setting up an S3 bucket to avoid permission restrictions. Also, try running it alongside a worker to ensure better performance.
Yazane
Yazaneโ€ข3mo ago
@๐—ป๐—ถ๐—ฐ๐—ผ๐—น๐—ฎ๐˜€ ok I'll try and tell you
๐—ป๐—ถ๐—ฐ๐—ผ๐—น๐—ฎ๐˜€
You can try using an open-source S3 solution, like MinIO. Coolify already provides ready-made examples for this.
jt196
jt196โ€ข2mo ago
@Cosmos @Divyadeep Sawhney @Yazane anybody solve this? I'm having the same issue. Looks like an issue with the JWT auth.
Want results from more Discord servers?
Add your server