cal.com icon indicating copy to clipboard operation
cal.com copied to clipboard

Self hosted url stuck at localhost:3000

Open gone opened this issue 1 year ago β€’ 21 comments

Issue Summary

When self hosting the url is stuck at localhost:3000

Steps to Reproduce

  1. use "install to render" button
  2. Set any/all of the nextauth_url, NEXT_PUBLIC_* envrionment values to the correct host
  3. Host is still on localhost:3000

gone avatar Apr 24 '23 17:04 gone

Same issue! Investigating

Draidel avatar May 03 '23 15:05 Draidel

same here

marcoantonio123456 avatar May 06 '23 00:05 marcoantonio123456

@gone have you tried changing it to 127.0.0.1:3000 IP instead of localhost

pranjalg13 avatar May 07 '23 13:05 pranjalg13

I believe it is related to the .yaml that docker uses. I forked https://github.com/calcom/docker, adjusted the .yaml file and pushed to the server again. It fixed SOME occurrences, but I there are still some issues

Draidel avatar May 07 '23 23:05 Draidel

Installed locally, modified the .env file with the full https:// url for NEXT_PUBLIC_WEBAPP_URL etc, and after login I still get bounced back to http://localhost:3000.

vsviridov avatar Jun 08 '23 23:06 vsviridov

I believe it's because Next.js uses port 3000 by default. Try one of these, in addition to changing the NEXT_PUBLIC_* environment variables:

  • Adding -p <PORT_NUMBER> after next dev/next start in apps/web/package.json
  • Running yarn dev -- -p <PORT_NUMBER>/yarn start -- -p <PORT_NUMBER>

oksdav avatar Aug 17 '23 21:08 oksdav

same problem here image

ur3an0 avatar Aug 30 '23 07:08 ur3an0

same issue here

Sharma-Rajat avatar Sep 14 '23 18:09 Sharma-Rajat

Has anyone solved this?

webenggeo avatar Oct 09 '23 19:10 webenggeo

+1 Screenshot 2023-10-10 at 07 47 48

sudo-eugene avatar Oct 10 '23 11:10 sudo-eugene

same issue here

ddilushan avatar Oct 31 '23 18:10 ddilushan

Same problem. Can anyone look into it? :'(

As far as my investigation goes, it seems that nothing is set in the process.env during the deployment so everything stays as default values.

Fritofour avatar Nov 26 '23 18:11 Fritofour

Looks like I found my problem. Just added the .env in the turbo.json.

"$schema": "https://turborepo.org/schema.json", "globalDotEnv": [".env"], "pipeline": {

Fritofour avatar Nov 26 '23 20:11 Fritofour

same

BeamNawapat avatar Dec 08 '23 15:12 BeamNawapat

After updating the .env file, refreshing the browser cache worked for me.

lperrious avatar Dec 20 '23 12:12 lperrious

Same here, in some links it's still pointing to localhost:3000

gutocarvalho avatar Feb 26 '24 02:02 gutocarvalho

It's been a year, I guess this won't be fixed anymore, maybe consider fork and fix on our own.

ghost avatar Apr 28 '24 16:04 ghost

It turns out calcom is using next.js 13 and still using pages router, a quick search revealed how these environment variable is used. The next.js doc suggest one should try to use getServerSideProps so environment variables can be read at runtime dynamically, I'll do a proof of concept shortly.

ghost avatar May 04 '24 03:05 ghost

I'm gradually fixing this by replacing most client side environment variables to incorporate getServerSideProps instead so they will be rendered at request time. I was a able to get it working in 2 places as of today. https://github.com/calcom/cal.com/compare/main...persuasive0pest:cal.com:main

ghost avatar May 05 '24 21:05 ghost

@nabby27 created a $30.00 reward using Opire

How to earn this reward?

Since this project does not have Opire bot installed yet 😞 you need to go to Opire and claim the rewards through your programmer's dashboard once you have your PR ready πŸ’ͺ

opiredev avatar May 16 '24 17:05 opiredev

Hi πŸ‘‹πŸΌ I created this reward because I would like to see this issue solved, maybe it's not enough but it's what I can offer if others put in their bit we can incentive some devs to solve this

nabby27 avatar May 16 '24 17:05 nabby27

According to a quick search it seems there are other instances of NEXT_PUBLIC_WEBAPP_URL being used elsewhere: https://github.com/search?q=repo%3Acalcom%2Fcal.com%20NEXT_PUBLIC_WEBAPP_URL&type=code I'm not immediately able to identify if they are being imported into frontend via transitive dependency, I'll try to find a tool to assist with the investigation.

There is one outstanding variable WEBAPP_URL located in: https://github.com/calcom/cal.com/blob/26bd02bd9409123f50f3501471738da66554f558/packages/lib/constants.ts#L11

That is imported into frontend but it's not in app folder. To properly handle it I'll create a context provider and feed all such variables from there, until all of them are taken care of. The context provider itself will be loading the values from getServerSideProps dynamically at runtime to ensure they reflect the desired value as expected.

ghost avatar May 23 '24 04:05 ghost

To resolve this issue for the Docker build, follow these steps:

  1. Remove the BUILT_NEXT_PUBLIC_WEBAPP_URL environment variable or set its value to http://localhost:3000.
  2. Set the NEXT_PUBLIC_WEBAPP_URL environment variable to your desired URL.

Refer to the following note from the solution reference:

# Replace the statically built BUILT_NEXT_PUBLIC_WEBAPP_URL with run-time NEXT_PUBLIC_WEBAPP_URL
# NOTE: if these values are the same, this will be skipped.

You can check the reference here: GitHub Reference.

fehzl avatar Jun 11 '24 06:06 fehzl

still no solution to this?...

netzpixel avatar Jul 24 '24 17:07 netzpixel

Any updates? Same issue here

JuanxCursed avatar Aug 08 '24 03:08 JuanxCursed