docker icon indicating copy to clipboard operation
docker copied to clipboard

Authentication Issue - Logging into Cal.com selfhosted

Open SecureCPU opened this issue 1 year ago • 11 comments

Hey, I keep getting the following error everytime I try to login. I updated just today, and started getting this error.

@calcom/web:start: [next-auth][error][CLIENT_FETCH_ERROR] @calcom/web:start: https://next-auth.js.org/errors#client_fetch_error fetch failed { @calcom/web:start: error: { @calcom/web:start: message: 'fetch failed', @calcom/web:start: stack: 'TypeError: fetch failed\n' + @calcom/web:start: ' at Object.fetch (node:internal/deps/undici/undici:11730:11)\n' + @calcom/web:start: ' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)', @calcom/web:start: name: 'TypeError' @calcom/web:start: }, @calcom/web:start: url: 'https://meetly.cc/api/auth/csrf', @calcom/web:start: message: 'fetch failed' @calcom/web:start: }

SecureCPU avatar Feb 13 '24 08:02 SecureCPU

Sounds like you need to set the NEXTAUTH_URL https://github.com/calcom/docker?tab=readme-ov-file#client_fetch_error

voska avatar Feb 29 '24 17:02 voska

@keithwillcode I think there is a cleaner solution here.

In the docker-compose.yaml file

calcom:
  image: calcom.docker.scarf.sh/calcom/cal.com
  ....
  networks:
    stack:
      aliases:
        - "example.com"

this eliminates the need for NEXTAUTH_URL for self-hosted docker-compose users and doesn't have the login/logout bugs

voska avatar Mar 02 '24 00:03 voska

@keithwillcode I think there is a cleaner solution here.

In the docker-compose.yaml file

calcom:
  image: calcom.docker.scarf.sh/calcom/cal.com
  ....
  networks:
    stack:
      aliases:
        - "example.com"

this eliminates the need for NEXTAUTH_URL for self-hosted docker-compose users and doesn't have the login/logout bugs

Ok great. Thanks for the suggestion

keithwillcode avatar Mar 02 '24 17:03 keithwillcode

Yes, I still cannot resolve the client fetch errors on unRaid using the latest container. If I use http://serverip:PORT/api/auth as the NEXTAUTH_URL variable, then I am unable to login as it gets stuck at 2FA and will not proceed. If I keep it as https://my.domain.com/api/auth, no issues logging in. However, the client fetch errors will appear in the logs. This used to be causing ECONNREFUSED errors before being fixed here: https://github.com/calcom/cal.com/issues/11911

Please let me know if there are steps to take now or if we need to wait for the docker containers to address the solution in a future release.

xcellentavi avatar Mar 04 '24 16:03 xcellentavi

@xcellentavi try modifying the docker-compose.yaml file, lines 38, 39:

    networks:
      - stack

change to:

  networks:
    stack:
      aliases:
        - "my.domain.com"

^ Note, this is "my.domain.com" without https://.

Then set the NEXTAUTH_URL var to https://my.domain.com/api/auth

This worked for my Synology setup.

voska avatar Mar 04 '24 16:03 voska

@voska thank you, but I don't use portainer or docker compose on unraid. I use community apps and will wait until this fix is pushed to a future release. Glad it is working for you and hope I can finally be rid of the client fetch errors soon!

xcellentavi avatar Mar 04 '24 17:03 xcellentavi

@xcellentavi can you point me to the Unraid app page/repo for this? I took a quick look here, but couldn't find it.

Does Unraid let you specify custom environment vars for an app?

voska avatar Mar 04 '24 19:03 voska

@xcellentavi can you point me to the Unraid app page/repo for this? I took a quick look here, but couldn't find it.

Does Unraid let you specify custom environment vars for an app?

Yeah, it was removed due to missing project and support tags, but I had installed it before it was taken down: https://github.com/ibracorp/unraid-templates/tree/master/cal.com

I have been tweaking and updating the variables along the way, but a few of us discuss the issues in the unraid forum here: https://forums.unraid.net/topic/133848-request-calcom-formerly-calendso/

The docker container template section lets you customize the paths, ports and variables.

xcellentavi avatar Mar 04 '24 20:03 xcellentavi

@voska I didn't tag you in the last comment, but let me know if you need any additional information or if you think there is someone else I should contact to get calcom added back to community apps. Thank you!

xcellentavi avatar Apr 06 '24 12:04 xcellentavi

@xcellentavi I'm not sure I can get it added back to the community app store (especially since I can't test it - I don't have an Unraid) but can you use/manually import a custom XML file like this one? https://github.com/ibracorp/unraid-templates/tree/master/cal.com

If so, I think we can get this working, but I'll need your help to test things out.

voska avatar Apr 09 '24 11:04 voska

@voska I am running mine on unraid no problem, but new users can't because it requires manual setup since it isn't appearing in community apps. One user was able to post instructions on manually adding the XML here: https://forums.unraid.net/topic/133848-request-calcom-formerly-calendso/#comment-1366375

It is missing some of the newer env variables, but again the goal would be to have it included in CA so anyone can load the container on their servers. No worries if this can't be done right now, and I'll keep try to bug ibracorp to update their template if possible.

xcellentavi avatar Apr 09 '24 11:04 xcellentavi