Skip to content

fix(analytics): use getBaseDomain for Profound host field#3848

Merged
waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1/fix-profound-host
Mar 30, 2026
Merged

fix(analytics): use getBaseDomain for Profound host field#3848
waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1/fix-profound-host

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • request.url on ECS resolves to the internal ALB hostname (ip-10-0-226-185.ec2.internal), not www.sim.ai
  • Profound silently drops entries whose host doesn't match a configured domain
  • Use getBaseDomain() to always send the correct public domain

Type of Change

  • Bug fix

Testing

Tested manually

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)

request.url resolves to internal ALB hostname on ECS, not the public domain
@cursor
Copy link
Copy Markdown

cursor bot commented Mar 30, 2026

PR Summary

Low Risk
Low risk: a small, localized change to analytics payload formatting that only affects the host field sent to Profound.

Overview
Updates Profound analytics logging so the host value is derived from getBaseDomain() (configured public app URL) rather than request.url’s resolved hostname.

This prevents logs from being attributed to internal ECS/ALB hostnames, improving acceptance/matching on the Profound side.

Written by Cursor Bugbot for commit 1030e13. Configure here.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Mar 30, 2026 10:30pm

Request Review

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 30, 2026

Greptile Summary

This is a targeted bug fix for Profound analytics on ECS deployments. On AWS ECS behind an ALB, request.url resolves to the internal ALB hostname (e.g., ip-10-0-226-185.ec2.internal) rather than the public domain. Since Profound silently drops log entries whose host field doesn't match a configured domain, all analytics were being discarded. The fix replaces url.hostname with getBaseDomain(), which reads from NEXT_PUBLIC_APP_URL to always return the correct public-facing domain.

  • The getBaseDomain() utility has proper fallback handling (try/catch with sensible defaults), so there's no risk of the analytics path throwing on misconfiguration.
  • The url variable is still used for url.pathname and url.searchParams — no dead code introduced.
  • The import uses the correct @/ path alias, consistent with the rest of the file.

Confidence Score: 5/5

  • Safe to merge — single-line fix with no logic regressions and robust fallback handling in the called utility.
  • The change is minimal and well-scoped: one import added, one field value replaced. getBaseDomain() is already battle-tested elsewhere in the codebase, has a try/catch fallback chain, and sendToProfound itself wraps everything in a try/catch. No P1 or P0 issues found.
  • No files require special attention.

Important Files Changed

Filename Overview
apps/sim/lib/analytics/profound.ts Replaces url.hostname (internal ALB hostname on ECS) with getBaseDomain() (reads from NEXT_PUBLIC_APP_URL) so the correct public domain is always sent to Profound's API.

Sequence Diagram

sequenceDiagram
    participant Client
    participant ALB as AWS ALB
    participant Proxy as proxy.ts (ECS)
    participant Profound as Profound API

    Client->>ALB: HTTP Request (host: www.sim.ai)
    ALB->>Proxy: Forward (request.url host: ip-10-0-226-185.ec2.internal)
    Note over Proxy: sendToProfound(request, statusCode)
    Note over Proxy: Before: url.hostname → "ip-10-0-226-185.ec2.internal" ❌
    Note over Proxy: After: getBaseDomain() → "www.sim.ai" ✅
    Proxy->>Profound: POST /logs [{host: "www.sim.ai", ...}]
    Note over Profound: Matches configured domain → entry accepted ✅
Loading

Reviews (1): Last reviewed commit: "fix(analytics): use getBaseDomain for Pr..." | Re-trigger Greptile

@waleedlatif1 waleedlatif1 merged commit 1d59eca into staging Mar 30, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/fix-profound-host branch March 30, 2026 22:36
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