fix: broken preview embed#19223
Conversation
|
Hariom Balhara seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
| const EMBED_LIB_URL = process.env.EMBED_PUBLIC_EMBED_LIB_URL ?? WEBAPP_URL; | ||
| const IS_E2E = process.env.NEXT_PUBLIC_IS_E2E === "1"; | ||
| const WEBAPP_URL = process.env.EMBED_PUBLIC_WEBAPP_URL || ""; | ||
| if (!WEBAPP_URL) { |
There was a problem hiding this comment.
Moved the check above to make it clear that EMBED_LIB_URL will always have a value.
| if (!WEBAPP_URL) { | ||
| throw new Error("WEBAPP_URL is not set"); | ||
| } | ||
| const EMBED_LIB_URL = process.env.EMBED_PUBLIC_EMBED_LIB_URL || WEBAPP_URL; |
There was a problem hiding this comment.
Removed Nullish colaesing operator as we want non falsy value. Empty string isn't a valid URL causing isSafeUrlCheck to crash
Normally, env variable is undefined but the way we are defining right now in vite, we always provide empty string fallback, which is the cause of the issue.
Graphite Automations"Add consumer team as reviewer" took an action on this PR • (02/10/25)1 reviewer was added to this PR based on Keith Williams's automation. "Add ready-for-e2e label" took an action on this PR • (02/11/25)1 label was added to this PR based on Keith Williams's automation. |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
E2E results are ready! |
Co-authored-by: Hariom Balhara <hariombalhara@gmgmail.com>
What does this PR do?
Fallback when EMBED_LIB_URL is empty string