T
Twenty5mo 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
15 Replies
Cosmos
CosmosOP5mo ago
docker compose file
John
John5mo 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
CosmosOP5mo ago
I added it to the docker worker, still no luck... I've also confirmed the callback URLs in Google APIs
No description
Uranium
Uranium5mo ago
Hello, can you please send the Google and Gmail url inside your .env ?
Cosmos
CosmosOP5mo 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
aficio5mo 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
charles5mo 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
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
Yazane4mo 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
Yazane4mo 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
jt1963mo ago
@Cosmos @Divyadeep Sawhney @Yazane anybody solve this? I'm having the same issue. Looks like an issue with the JWT auth.
arnavsaxena
arnavsaxena5w ago
Hi, facing the same issue Is it possible to solve it without setting up the s3 bucket?
martmull
martmull4w ago
Hey, I checked on our own google console - we don't have any Authorized JavaScript origins URI - we only have those 2 URIs for Authorized redirect URIs http://localhost:3000/auth/google/redirect http://localhost:3000/auth/google-apis/get-access-token Then here are the .env useful variables
AUTH_GOOGLE_ENABLED=true
AUTH_GOOGLE_CLIENT_ID=REDACTED
AUTH_GOOGLE_CLIENT_SECRET=REDACTED
AUTH_GOOGLE_CALLBACK_URL=http://localhost:3000/auth/google/redirect
AUTH_GOOGLE_APIS_CALLBACK_URL=http://localhost:3000/auth/google-apis/get-access-token
AUTH_GOOGLE_ENABLED=true
AUTH_GOOGLE_CLIENT_ID=REDACTED
AUTH_GOOGLE_CLIENT_SECRET=REDACTED
AUTH_GOOGLE_CALLBACK_URL=http://localhost:3000/auth/google/redirect
AUTH_GOOGLE_APIS_CALLBACK_URL=http://localhost:3000/auth/google-apis/get-access-token
find AUTH_GOOGLE_CLIENT_ID and AUTH_GOOGLE_CLIENT_SECRET in Additional Informations section of the google console page Make sure you restart your server when you update your environment variables. Worker service is not useful for Google authentication If the issue persists, can you provide your server logs when you are reaching the blank page?
No description
Want results from more Discord servers?
Add your server