R
Railway•9mo ago
Master Adit

Cal not deploying correctly on Railway

I deployed Cal template on Railway, but when I open the URL, it is showing a blank page. The logs show a lot of errors. I have tried redeploying multiple times (and tried created a new project as well), but I am getting the same errors every time. Can someone please help?
Solution:
i tested a template deploy with the latest tag, and adding a DATABASE_DIRECT_URL variable and i can see that the migrations where ran
Jump to solution
56 Replies
Percy
Percy•9mo ago
Project ID: bec0b4e9-7ab8-4fc1-bfd2-11b968fbdfa4
Master Adit
Master AditOP•9mo ago
bec0b4e9-7ab8-4fc1-bfd2-11b968fbdfa4
Brody
Brody•9mo ago
Master Adit
Master AditOP•9mo ago
Yes
Brody
Brody•9mo ago
okay ill deploy it and see whats up
Master Adit
Master AditOP•9mo ago
Okay, thank you!
Brody
Brody•9mo ago
did you provide your google api credential?
Master Adit
Master AditOP•9mo ago
Yes I just noticed some discrepancy on my Google Cloud Console. I'll make the changes and update you if it solves the issue. I had not added my custom domain to my Railway project, but my Authorized redirect URIs were pointing to the custom domain on Google Cloud. I added the domain on Railway, but I am still getting the same blank screen when I open the URL.
Master Adit
Master AditOP•9mo ago
Yes, I just rechecked all the steps again. The only change I made a few minutes ago was changing GOOGLE_LOGIN_ENABLED from false to true (I thought it might fix the issue). One of the errors I am seeing in the logs a lot is:
2024-03-03 04:30:07.842 UTC [159] ERROR: relation "public.users" does not exist at character 57

2024-03-03 04:30:07.842 UTC [159] STATEMENT: SELECT COUNT(*) FROM (SELECT "public"."users"."id" FROM "public"."users" WHERE 1=1 OFFSET $1) AS "sub"

@calcom/web:start: PrismaClientKnownRequestError:

@calcom/web:start: Invalid `prisma.user.count()` invocation:

@calcom/web:start:

@calcom/web:start:

@calcom/web:start: The table `public.users` does not exist in the current database.

@calcom/web:start: at Cn.handleRequestError (/calcom/node_modules/@prisma/client/runtime/library.js:123:6817)

@calcom/web:start: at Cn.handleAndLogRequestError (/calcom/node_modules/@prisma/client/runtime/library.js:123:6206)

@calcom/web:start: at Cn.request (/calcom/node_modules/@prisma/client/runtime/library.js:123:5926)

@calcom/web:start: at async l (/calcom/node_modules/@prisma/client/runtime/library.js:128:9968)

@calcom/web:start: at async getServerSideProps (/calcom/apps/web/.next/server/pages/auth/login.js:1:10204) {

@calcom/web:start: code: 'P2021',

@calcom/web:start: clientVersion: '5.4.2',

@calcom/web:start: meta: { table: 'public.users' }

@calcom/web:start: }

@calcom/web:start: 04:30:08:324 WARNorgDomains.ts Match of WEBAPP_URL with ALLOWED_HOSTNAME failed {

@calcom/web:start: WEBAPP_URL: 'https://cal-production-baf8.up.railway.app';,

@calcom/web:start: ALLOWED_HOSTNAMES: []

@calcom/web:start: }
2024-03-03 04:30:07.842 UTC [159] ERROR: relation "public.users" does not exist at character 57

2024-03-03 04:30:07.842 UTC [159] STATEMENT: SELECT COUNT(*) FROM (SELECT "public"."users"."id" FROM "public"."users" WHERE 1=1 OFFSET $1) AS "sub"

@calcom/web:start: PrismaClientKnownRequestError:

@calcom/web:start: Invalid `prisma.user.count()` invocation:

@calcom/web:start:

@calcom/web:start:

@calcom/web:start: The table `public.users` does not exist in the current database.

@calcom/web:start: at Cn.handleRequestError (/calcom/node_modules/@prisma/client/runtime/library.js:123:6817)

@calcom/web:start: at Cn.handleAndLogRequestError (/calcom/node_modules/@prisma/client/runtime/library.js:123:6206)

@calcom/web:start: at Cn.request (/calcom/node_modules/@prisma/client/runtime/library.js:123:5926)

@calcom/web:start: at async l (/calcom/node_modules/@prisma/client/runtime/library.js:128:9968)

@calcom/web:start: at async getServerSideProps (/calcom/apps/web/.next/server/pages/auth/login.js:1:10204) {

@calcom/web:start: code: 'P2021',

@calcom/web:start: clientVersion: '5.4.2',

@calcom/web:start: meta: { table: 'public.users' }

@calcom/web:start: }

@calcom/web:start: 04:30:08:324 WARNorgDomains.ts Match of WEBAPP_URL with ALLOWED_HOSTNAME failed {

@calcom/web:start: WEBAPP_URL: 'https://cal-production-baf8.up.railway.app';,

@calcom/web:start: ALLOWED_HOSTNAMES: []

@calcom/web:start: }
So I went to the data tab in Railway, but it wasn't working. Spent a lot of time trying to figure out how to make it work, but then I saw a message in this server that I should use an external database client to access the database. I downloaded DBeaver, enabled external network in Postgres on Railway, entered all the details in DBeaver, but it couldn't connect to the database. So now I am back to the beginning :(
Brody
Brody•9mo ago
a redeploy of the database is required after enabling the tcp proxy for the very first time
Master Adit
Master AditOP•9mo ago
Oh, okay. Trying that now.
Brody
Brody•9mo ago
are you still using the railway provided domain, or have you added a custom domain?
Master Adit
Master AditOP•9mo ago
Added a custom domain
Brody
Brody•9mo ago
have you redeployed the cal service since then?
Master Adit
Master AditOP•9mo ago
I believe I did, but I'll try again just to be sure Postgres redeployment done, but DBeaver connection is still timing out.
Brody
Brody•9mo ago
are you sure you are using all the correct credentials?
Master Adit
Master AditOP•9mo ago
Redeployed Cal service, same issue is still there
Master Adit
Master AditOP•9mo ago
I noticed Railway did not automatically add the public host in Postgres service's variables:
No description
Master Adit
Master AditOP•9mo ago
Should I add it manually and redeploy?
Brody
Brody•9mo ago
nope, please don't that would only mess something else up show me a screenshot of the public network section of the database service settings
Master Adit
Master AditOP•9mo ago
No description
Brody
Brody•9mo ago
that is an http domain, postgres does not use http, postgres uses tcp
Master Adit
Master AditOP•9mo ago
No description
Brody
Brody•9mo ago
that internal port looks wrong it's 5432, you where close
Master Adit
Master AditOP•9mo ago
I'm sorry, my bad. Fixed it.
No description
Brody
Brody•9mo ago
okay now a redeploy is needed
Master Adit
Master AditOP•9mo ago
Should I put these values in DBeaver? Host: viaduct.proxy.rlwy.net Port: 5432 Database: railway Username: <taken from POSTGRES_USER variable> Password: <taken from POSTGRES_PASSWORD variable>
Brody
Brody•9mo ago
5432 is the internal port, you need to use the public port (the bigger number)
Master Adit
Master AditOP•9mo ago
Okay, connection was done successfully!
Master Adit
Master AditOP•9mo ago
Looks like there are no tables?
No description
Brody
Brody•9mo ago
maybe migrations didn't run for some reason I wonder if cal changed something
Master Adit
Master AditOP•9mo ago
Oh, is there anything I can do to check?
Brody
Brody•9mo ago
honestly no clue right now, I may have created the template, but I don't personally use it
Master Adit
Master AditOP•9mo ago
Oh, okay
Brody
Brody•9mo ago
try deploying the template again?
Master Adit
Master AditOP•9mo ago
Already tried it thrice 🥲 I'll try again
Brody
Brody•9mo ago
nah 3 times is good
Master Adit
Master AditOP•9mo ago
I think the issue is linked to Cal. Found a thread on their server which might be linked to this:
Brody
Brody•9mo ago
hmmm, my template uses postgres 16 their offical self hosted docs for docker use postgres 16 https://github.com/calcom/docker/blob/main/docker-compose.yaml#L15
Master Adit
Master AditOP•9mo ago
https://github.com/calcom/docker/issues/329 - looks like the current quick fix is to use v3.7.11 tag. They haven't released the docker image for the latest version.
GitHub
Issue with docker hub images · Issue #329 · calcom/docker
Hello Guys, i don't know why but last tag on docker hub is 3.7.16. The newest release on github is 3.8.0-rc https://hub.docker.com/r/calcom/cal.com/tags
Brody
Brody•9mo ago
okay swap the image in use to that tag
Master Adit
Master AditOP•9mo ago
Just to confirm, I have to disconnect this and add the tag, right?
No description
Brody
Brody•9mo ago
correct
Master Adit
Master AditOP•9mo ago
Changed it to calcom/cal.com:v3.7.11. Redeploying now.
Applying migration `20231110122349_paid_apps`

Applying migration `20231113131945_idx_teamid_verification_token`

Applying migration `20231113202947_add_ical_columns_to_booking`

Applying migration `20231114090318_add_avatar_url`

Applying migration `20231117002911_add_users_locked`

Applying migration `20231117081852_idx_eventtype_scheduleid`

Applying migration `20231202181233_adding_show_first_available_timeslot`

Applying migration `20231203154633_adding_is_mandatory_reminder_field_for_mandatory_reminders`

Applying migration `20231206191034_add_cal_video_logo`

Applying migration `20231206220118_add_recurring_event_id`

Applying migration `20231213083720_add_meeting_started_webhook`

Applying migration `20231213153230_add_instant_meeting`

Applying migration `20240105110500_removed_newbooker_feature_flag`

Applying migration `20240109041925_add_out_of_office_entry_table`

Applying migration `20240111075727_remove_brand_colours_default`

Applying migration `20240114195534_assign_all_team_members`
Applying migration `20231110122349_paid_apps`

Applying migration `20231113131945_idx_teamid_verification_token`

Applying migration `20231113202947_add_ical_columns_to_booking`

Applying migration `20231114090318_add_avatar_url`

Applying migration `20231117002911_add_users_locked`

Applying migration `20231117081852_idx_eventtype_scheduleid`

Applying migration `20231202181233_adding_show_first_available_timeslot`

Applying migration `20231203154633_adding_is_mandatory_reminder_field_for_mandatory_reminders`

Applying migration `20231206191034_add_cal_video_logo`

Applying migration `20231206220118_add_recurring_event_id`

Applying migration `20231213083720_add_meeting_started_webhook`

Applying migration `20231213153230_add_instant_meeting`

Applying migration `20240105110500_removed_newbooker_feature_flag`

Applying migration `20240109041925_add_out_of_office_entry_table`

Applying migration `20240111075727_remove_brand_colours_default`

Applying migration `20240114195534_assign_all_team_members`
I see a lot of logs like this 👀 I hope it works.
Brody
Brody•9mo ago
migrations are running, thats good
Master Adit
Master AditOP•9mo ago
It worked!
Brody
Brody•9mo ago
updated the template too temporarily, thanks for bringing this up
No description
Master Adit
Master AditOP•9mo ago
Thanks a lot for helping! I'll keep an eye on their releases. I hope it is fixed soon. Will ping you if there's an update.
Brody
Brody•9mo ago
sounds good!
Solution
Brody
Brody•9mo ago
i tested a template deploy with the latest tag, and adding a DATABASE_DIRECT_URL variable and i can see that the migrations where ran
Master Adit
Master AditOP•9mo ago
What value to put in it?
Brody
Brody•9mo ago
the same as the DATABASE_URL variable
${{Postgres.DATABASE_PRIVATE_URL}}
${{Postgres.DATABASE_PRIVATE_URL}}
Master Adit
Master AditOP•9mo ago
Trying this with calcom/cal.com It is working! Thanks!
Brody
Brody•9mo ago
awesome, then I'll add that variable to the public template and go back to the latest tag
Kilian S.
Kilian S.•4mo ago
Hi @Master Adit I just see you were running in the same issues as I did when I’ve tried cal. Would you please be available for assisting me via dm when I do a retry, please Looking forward to receive your expertise
Want results from more Discord servers?
Add your server