calcom / cal.com

Scheduling infrastructure for absolutely everyone.

Home Page:https://cal.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[CAL-3737] Railway deployment does not work

dipyamanroy opened this issue · comments

Issue Summary

Deployment using Railway shows up as active, however the URL which points to Cal does not load, or loads briefly with error 500.

Steps to Reproduce

  1. Use the one-click deploy with Railway.
  2. Add your Google API key, and proceed to deploy both Cal and Postgres.
  3. Click on URL generated by Railway.

Expected result is a deployment of Cal with a login page.

Actual Results

  • Blank page or brief displays of Error 500.

Expected Results

  • Login page from Cal

Technical details

Logs from Railway:

@calcom/web:start: SyntaxError: Unexpected token A in JSON at position 0
@calcom/web:start:     at JSON.parse (<anonymous>)
@calcom/web:start:     at 761191 (/calcom/apps/web/.next/server/pages/auth/login.js:1:12370)
@calcom/web:start:     at __webpack_require__ (/calcom/apps/web/.next/server/webpack-runtime.js:1:161)
@calcom/web:start:     at /calcom/apps/web/.next/server/pages/auth/login.js:1:11124
@calcom/web:start:     at __webpack_require__.a (/calcom/apps/web/.next/server/webpack-runtime.js:1:1070)
@calcom/web:start:     at 222186 (/calcom/apps/web/.next/server/pages/auth/login.js:1:10981)
@calcom/web:start:     at __webpack_require__ (/calcom/apps/web/.next/server/webpack-runtime.js:1:161)
@calcom/web:start:     at /calcom/apps/web/.next/server/pages/auth/login.js:1:6541
@calcom/web:start:     at __webpack_require__.a (/calcom/apps/web/.next/server/webpack-runtime.js:1:1070)
@calcom/web:start:     at 130133 (/calcom/apps/web/.next/server/pages/auth/login.js:1:6135)
@calcom/web:start: 16:07:46:497	WARNorgDomains.ts Match of WEBAPP_URL with ALLOWED_HOSTNAME failed {
@calcom/web:start:   WEBAPP_URL: 'https://cal-production-a4cb.up.railway.app'/;,
@calcom/web:start:   ALLOWED_HOSTNAMES: []
@calcom/web:start: }

Evidence

  • Tested using redeployment on Railway. The same issue persists.
    image

CAL-3737

The error logs indicate two primary issues with your Railway deployment of Cal: a JSON syntax error and a domain matching warning. Here's how to address them:

  1. JSON Syntax Error: This likely stems from improperly set or parsed environment variables. Verify that your DATABASE_URL and other relevant environment variables are correctly configured in Railway, matching the format and values expected by Cal.

  2. Domain Matching Warning: Add your Railway app's domain to the ALLOWED_HOSTNAMES environment variable to resolve the domain matching warning. If your app's URL is https://cal-production-a4cb.up.railway.app, include this in the ALLOWED_HOSTNAMES.

  3. Environment Variables: Double-check all required environment variables are set, including those for authentication, database connections, and any other services your deployment needs. For SSL connections with PostgreSQL, you might need to set PGSSLMODE to no-verify.

  4. Database Migrations: Ensure you've run the necessary database migrations for Cal, as a mismatch between the database schema and the application's expectations can lead to errors.

Addressing these points should help resolve the issues you're encountering with your Railway deployment of Cal.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

would love some help from the railway team

Looks like @brody192 owns the Cal template. Brody do you want to have a look to make sure that this works?

I’d bet it’s missing an envvar that was added or something

Alternatively, might be good for the Cal team to own the template itself. Got thousands of people on it so:

  1. You’d control the health of that experience/deployment
  2. You’d make $$$ for it

Thanks for the ping Cooper, Will be heading out on a trip with friends today and tomorrow, but will see what I can find out!

After deploying the template I set a ALLOWED_HOSTNAMES variable to "${{RAILWAY_PUBLIC_DOMAIN}}" (with the quotes) and without the scheme as the env.example file shows.

@calcom/web:start: 12:14:48:757	WARNorgDomains.ts Match of WEBAPP_URL with ALLOWED_HOSTNAME failed {
@calcom/web:start:   WEBAPP_URL: 'https://cal-production-f5f0.up.railway.app';,
@calcom/web:start:   ALLOWED_HOSTNAMES: [
@calcom/web:start:     'cal-production-f5f0.up.railway.app'
@calcom/web:start:   ]
@calcom/web:start: }

I must be missing something because that hostname is definitely a match to the hostname in WEBAPP_URL?

NEXT_PUBLIC_WEBAPP_URL is set to https://${{RAILWAY_PUBLIC_DOMAIN}}

And for what it's worth, the Railway generated domain still opens and redirects to /auth/setup without any error codes or white screens returned.