cal.com
cal.com copied to clipboard
`destination` does not start with `/`, `http://`, or `https://` for route
Issue Summary
Updating from v3.8.5 to v3.9.4 leads to an error during yarn build
Steps to Reproduce
- git checkout on v3.9.4
- yarn
- yarn build
Actual Results
@calcom/web:build: cache miss, executing c8414372ccbf40f0
@calcom/web:build: Duplicate value found in common.json keys: seats_available_other and seats_available_one
@calcom/web:build: Duplicate value found in common.json keys: location_variable and location
@calcom/web:build: Duplicate value found in common.json keys: additional_notes_variable and additional_notes
@calcom/web:build: Duplicate value found in common.json keys: already_have_account and already_have_an_account
@calcom/web:build: Duplicate value found in common.json keys: timezone_variable and timezone
@calcom/web:build: Duplicate value found in common.json keys: scheduling_for_your_team and workflow_automation
@calcom/web:build: Duplicate value found in common.json keys: saml_sso and saml_config
@calcom/web:build: Duplicate value found in common.json keys: advanced_managed_events_description and unified_billing_description
@calcom/web:build: `destination` does not start with `/`, `http://`, or `https://` for route {"source":"/api/v2/:path*","destination":"undefined/:path*"}
@calcom/web:build:
@calcom/web:build:
@calcom/web:build: Error: Invalid rewrite found
@calcom/web:build: ERROR: command finished with error: command (/data/cal/apps/web) yarn run build exited (1)
command (/data/cal/apps/web) yarn run build exited (1)
Tasks: 6 successful, 7 total
Cached: 2 cached, 7 total
Time: 18.504s
Failed: @calcom/web#build
ERROR run failed: command exited (1)
Expected Results
Build would work
Technical details
- Node v18.19.0
Hey @olivierlambert! 👋 It's Dosu again.
After reviewing the error log you've provided, it seems like the issue is related to an invalid rewrite rule in your configuration. The error message destination does not start with '/', 'http://', or 'https://' for route {"source":"/api/v2/:path*","destination":"undefined/:path*"}
indicates that the destination for a rewrite rule is incorrectly set to "undefined/:path*"
, which is not a valid URL or path.
This usually happens when environment variables or configuration settings that are supposed to define these URLs are not correctly set, leading to the placeholder undefined
being used in the actual configuration.
Here's a step-by-step guide to troubleshoot and potentially fix this issue:
-
Check Environment Variables: Ensure that all environment variables or configuration settings related to URLs or paths are correctly set. It's possible that a variable expected to define the destination URL is missing or not passed correctly.
-
Review Configuration Files: Look into your
next.config.js
or equivalent configuration files where rewrite rules are defined. Verify that all destinations are correctly set and that no placeholder or undefined values are used. -
Update Rewrite Rules: If you find any rewrite rules with destinations starting with
undefined
, update them to the correct paths or URLs. Ensure that all routes are correctly defined and point to valid destinations. -
Test Locally: Before pushing your changes, try running
yarn build
locally to see if the issue persists. This can help catch any other potential problems early on. -
Consult Documentation: If you're still stuck, reviewing the official documentation for rewrite rules and environment configuration might provide additional insights or examples that could help.
If after following these steps the issue remains unresolved, it might be helpful to provide more details about your configuration and the specific setup you're using. This could include parts of your next.config.js
file or details about how environment variables are set and passed in your project.
I hope this helps get you closer to a solution! If you have any more questions or need further assistance, feel free to ask. 🚀
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.
If you want to continue the conversation, start your reply with @dosu-bot.
I didn't not change the .env file and I never had this issue before, so it might worth it to have an actual human taking a look at some point :D
I'm taking a deeper look on what I could have done wrong, but I found nothing right now.
Hey @olivierlambert! I understand the frustration when things don't work as expected, especially when you haven't made any changes that would obviously cause the issue. While I've tried to provide some guidance, it seems like this might require a closer look from someone with more context on the project's specifics.
@keithwillcode, this one's a bit out of my wheelhouse, could you step in and provide your guidance?
In the meantime, @olivierlambert, if there's anything else you think might be relevant or if you've made any discoveries on your end, please feel free to share. Your insights could be very helpful in diagnosing the issue more quickly.
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.
If you want to continue the conversation, start your reply with @dosu-bot.
So it seems there's a new var in env
, called NEXT_PUBLIC_API_V2_URL
. I'm investigating what it should be in my self-hosted environment.
Adding the var in env
make it work, but I can't find a lot of documentation on what it does and if I need to use a different URL than the default one given in the .env.example
file.
Adding the var in
env
make it work, but I can't find a lot of documentation on what it does and if I need to use a different URL than the default one given in the.env.example
file.
@olivierlambert it's used here https://github.com/calcom/cal.com/blob/0ee81d0739cab4138e4db1daa46a4aacf5b99d4d/apps/web/next.config.js#L309 which explains why the invalid rewrite rule error is happening.
I'll take a look at this
@olivierlambert glad you found the new .env. we are moving to a new API right now and once thats done we are introducing proper upgrade paths starting at cal.com v5.0 with in-depth upgrading tutorials and scripts with https://codemod.com 🥳
Understood. As long as the env file explains the new additions and what should be used (or a changelog), I am perfectly happy with it!