Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Description

fix chat deploy URL in prod, shows www. prefix even though it actually deploys to the correct URL

Type of change

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

How Has This Been Tested?

Tested locally, tested in staging,

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • All tests pass locally and in CI (bun run test)
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • I have updated version numbers as needed (if needed)
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Security Considerations:

  • My changes do not introduce any new security vulnerabilities
  • I have considered the security implications of my changes

@vercel
Copy link

vercel bot commented Jul 23, 2025

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

Name Status Preview Comments Updated (UTC)
sim 🔄 Building (Inspect) Visit Preview 💬 Add feedback Jul 23, 2025 9:12am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Skipped (Inspect) Jul 23, 2025 9:12am

@waleedlatif1 waleedlatif1 merged commit e90138a into staging Jul 23, 2025
2 of 3 checks passed
Copy link
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 URL display bug in the chat deployment feature where production environments were incorrectly showing the www. prefix in chat URLs. The fix addresses two key areas:

In apps/sim/app/api/chat/route.ts: The change adds manual logic to strip the www. prefix from the host before constructing chat URLs. When creating a subdomain URL, the code now checks if the host starts with www. and removes it, ensuring URLs follow the correct format (subdomain.simstudio.ai instead of subdomain.www.simstudio.ai).

In apps/sim/app/api/chat/edit/[id]/route.ts: The fix replaces two instances of getBaseDomain() with getEmailDomain() for chat URL generation. The getEmailDomain() function was specifically designed to strip the www. prefix for email compatibility, making it the appropriate choice for subdomain URL construction.

Both changes align the URL generation logic across the chat API endpoints, ensuring consistent behavior. The getEmailDomain() function from the utils library already handles the www. stripping logic, so using it in the edit route creates better code consistency while the manual approach in the main route maintains the existing URL construction pattern.

Confidence score: 4/5

• This is a safe bug fix that addresses a cosmetic URL display issue without changing deployment functionality
• The score reflects the straightforward nature of the changes and alignment with existing patterns, though the manual approach in one file could be unified
• Both files need attention to ensure the URL generation logic is working as expected across different environments

2 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

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.

2 participants