Use app url#1212
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Deployment failed with the following error: Learn More: https://vercel.link/multiple-function-regions |
Greptile SummaryThis PR refactors
Confidence Score: 4/5Safe to merge — the core logic change (preferring The production path is unchanged. The branch-URL preference is straightforward and the fallback chain to src/config/index.ts — specifically the Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[getAppUrl called] --> B{VERCEL_ENV === 'production'?}
B -- Yes --> C[return https:// + VERCEL_PROJECT_PRODUCTION_URL]
B -- No --> D{VERCEL_BRANCH_URL set?}
D -- Yes --> E[return https:// + VERCEL_BRANCH_URL]
D -- No --> F{VERCEL_URL starts with 'http'?}
F -- Yes --> G[return VERCEL_URL as-is - dead code: Vercel never sets protocol prefix]
F -- No --> H{preview or staging?}
H -- Yes --> I[return https:// + VERCEL_URL]
H -- No --> J[return http:// + VERCEL_URL]
Reviews (1): Last reviewed commit: "Merge branch 'feature/c1-optimization' i..." | Re-trigger Greptile |
| const url = process.env.VERCEL_URL | ||
| if (url && url.startsWith('http')) { | ||
| return url | ||
| } | ||
|
|
||
| const isVercelDeployment = vercelEnv === 'preview' || vercelEnv === 'staging' |
There was a problem hiding this comment.
The
startsWith('http') branch is effectively dead code. Vercel's VERCEL_URL is documented to contain only the hostname (e.g. my-app-abc123.vercel.app) — never a protocol-prefixed URL — so this condition will never be true in any Vercel environment. Leaving it in can mislead future readers into thinking VERCEL_URL might carry a protocol, and it silently skips the https/http selection logic even if a misconfigured value were passed. The guard can be removed safely.
| const url = process.env.VERCEL_URL | |
| if (url && url.startsWith('http')) { | |
| return url | |
| } | |
| const isVercelDeployment = vercelEnv === 'preview' || vercelEnv === 'staging' | |
| const url = process.env.VERCEL_URL | |
| const isVercelDeployment = vercelEnv === 'preview' || vercelEnv === 'staging' |
Changes