Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
There was a problem hiding this comment.
Greptile Summary
This PR fixes a critical build failure that occurs in CI environments where the NEXT_PUBLIC_APP_URL environment variable is not available at build time. The changes are made to apps/sim/lib/branding/metadata.ts and specifically address Next.js metadata generation requirements.
The core issue was that the code previously assumed NEXT_PUBLIC_APP_URL would always be available when generating metadata for SEO and social media sharing. However, in CI environments, this variable may not be set during the build phase, causing Next.js to fail when trying to create URL objects for the metadataBase and openGraph.url properties.
The fix introduces proper null checks and fallback values:
metadataBasenow falls back tonew URL('https://sim.ai')whenNEXT_PUBLIC_APP_URLis undefinedopenGraph.urldefaults to'https://sim.ai'using the logical OR operator
This approach aligns with the application's architecture that supports runtime environment variable injection via Docker (as seen in the codebase's use of next-runtime-env). The fallback to 'https://sim.ai' is logical since it matches the application's primary domain and ensures consistent metadata generation across different deployment scenarios.
Confidence score: 4/5
- This PR is safe to merge with minimal risk as it only adds defensive null checks and sensible fallbacks
- Score reflects a straightforward bug fix that addresses a specific build failure without introducing complex logic changes
- No files require special attention - the changes are isolated to metadata configuration with well-understood fallback behavior
1 file reviewed, 1 comment
| type: 'website', | ||
| locale: 'en_US', | ||
| url: env.NEXT_PUBLIC_APP_URL, | ||
| url: env.NEXT_PUBLIC_APP_URL || 'https://sim.ai', |
There was a problem hiding this comment.
style: Consider using the same conditional pattern as metadataBase for consistency
Summary
fixed build, previously assumed that it had access to NEXT_PUBLIC_APP_URL at runtime but it isn't set in CI
Type of Change
Testing
NA
Checklist