Skip to content

fix(build): fixed build#893

Merged
waleedlatif1 merged 1 commit intostagingfrom
fix/build
Aug 7, 2025
Merged

fix(build): fixed build#893
waleedlatif1 merged 1 commit intostagingfrom
fix/build

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

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

  • Bug fix

Testing

NA

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link
Copy Markdown

vercel bot commented Aug 7, 2025

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

Name Status Preview Comments Updated (UTC)
sim ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2025 4:48am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Skipped (Inspect) Aug 7, 2025 4:48am

@waleedlatif1 waleedlatif1 merged commit e164e32 into staging Aug 7, 2025
4 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/build branch August 7, 2025 04:48
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

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:

  • metadataBase now falls back to new URL('https://sim.ai') when NEXT_PUBLIC_APP_URL is undefined
  • openGraph.url defaults 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

Edit Code Review Bot Settings | Greptile

type: 'website',
locale: 'en_US',
url: env.NEXT_PUBLIC_APP_URL,
url: env.NEXT_PUBLIC_APP_URL || 'https://sim.ai',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

style: Consider using the same conditional pattern as metadataBase for consistency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant