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

fix: webapp_url env var not reflected client side #802

Merged
merged 1 commit into from
Sep 12, 2023

Conversation

ShubhamPalriwala
Copy link
Contributor

What does this PR do?

  1. We are importing the SURVEY_BASE_URL from the constants.ts which reads the NEXT_PUBLIC_SURVEY_BASE_URL and if it does not exist, it sets it to the WEBAPP_URL/s/.
  2. Now, the WEBAPP_URL is determined by:
export const WEBAPP_URL = process.env.WEBAPP_URL ||  process.env.NEXT_PUBLIC_WEBAPP_URL || VERCEL_URL || RAILWAY_STATIC_URL ||  HEROKU_URL || RENDER_URL || "http://localhost:3000/";
  1. And since the import is on the CLIENT side, it cannot read the WEBAPP_URL from the env vars (does not have the NEXT_PUBLIC_ prefix) hence goes to the backup localhost:3000!

This PR fixes that by parsing and passing the surveyBaseUrl as a prop to all the client side components!

Fixes #799

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How should this be tested?

Set a WEBAPP_URL other than localhost:3000 and it should reflect the same when sharing the Link survey either from the share modal or from the surveys dropdown page!

Checklist

  • Added a screen recording or screenshots to this PR
  • Filled out the "How to test" section in this PR
  • Read the contributing guide
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand bits
  • Ran pnpm build
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues
  • Updated the Formbricks Docs if changes were necessary

@vercel
Copy link

vercel bot commented Sep 12, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
formbricks-cloud ❌ Failed (Inspect) Sep 12, 2023 4:22am
1 Ignored Deployment
Name Status Preview Updated (UTC)
formbricks-com ⬜️ Ignored (Inspect) Sep 12, 2023 4:22am

@github-actions
Copy link
Contributor

Thank you for following the naming conventions for pull request titles! 🙏

@github-actions github-actions bot added the bug Something isn't working label Sep 12, 2023
Copy link
Member

@mattinannt mattinannt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ShubhamPalriwala thanks a lot for the PR 😊💪 Looks great! :-)

@mattinannt mattinannt merged commit cbc6491 into main Sep 12, 2023
10 of 14 checks passed
@mattinannt mattinannt deleted the shubham/webapp-url-env-bug branch September 12, 2023 04:27
@noahnoahk
Copy link

i have not ran into any bug after the update

waseemrabani pushed a commit to LuminosoInsight/formbricks that referenced this pull request Feb 2, 2024
waseemrabani pushed a commit to LuminosoInsight/formbricks that referenced this pull request Feb 2, 2024
waseemrabani pushed a commit to LuminosoInsight/formbricks that referenced this pull request Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] localhost:3000 survey share URL with v1.0.3
3 participants