Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

destination does not start with /, http://, or https:// for route #14310

Closed
olivierlambert opened this issue Apr 3, 2024 · 9 comments
Closed
Labels
automated-tests area: unit tests, e2e tests, playwright 🐛 bug Something isn't working ci area: CI, DX, pipeline, github actions ui area: UI, frontend, button, form, input

Comments

@olivierlambert
Copy link

olivierlambert commented Apr 3, 2024

Issue Summary

Updating from v3.8.5 to v3.9.4 leads to an error during yarn build

Steps to Reproduce

  1. git checkout on v3.9.4
  2. yarn
  3. 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
@maige-app maige-app bot added the 🐛 bug Something isn't working label Apr 3, 2024
Copy link

dosubot bot commented Apr 3, 2024

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:

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

@dosubot dosubot bot added automated-tests area: unit tests, e2e tests, playwright ci area: CI, DX, pipeline, github actions ui area: UI, frontend, button, form, input labels Apr 3, 2024
@olivierlambert
Copy link
Author

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.

Copy link

dosubot bot commented Apr 3, 2024

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.

@olivierlambert
Copy link
Author

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.

@olivierlambert
Copy link
Author

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.

@livingmine
Copy link

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

destination: `${process.env.NEXT_PUBLIC_API_V2_URL}/:path*`,
which explains why the invalid rewrite rule error is happening.

@JosephManni
Copy link

I'll take a look at this

@PeerRich PeerRich closed this as not planned Won't fix, can't repro, duplicate, stale May 16, 2024
@PeerRich
Copy link
Member

@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 🥳

@olivierlambert
Copy link
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automated-tests area: unit tests, e2e tests, playwright 🐛 bug Something isn't working ci area: CI, DX, pipeline, github actions ui area: UI, frontend, button, form, input
Projects
None yet
Development

No branches or pull requests

4 participants