agentops icon indicating copy to clipboard operation
agentops copied to clipboard

Fix local development console errors

Open areibman opened this issue 4 months ago • 1 comments

📥 Pull Request

📘 Description This PR addresses the excessive console errors in local development mode by:

  • Gating PostHog initialization to only run in production or when explicitly enabled via NEXT_PUBLIC_ENABLE_POSTHOG_IN_DEV=true.
  • Adding checks to signin and simple-login pages to prevent unnecessary /opsboard/users/me API calls (and subsequent 401 errors) when no session_id cookie is present.
  • Removing an unused PostHog import.

These changes significantly reduce console noise, improving the local development experience.

🧪 Testing

  1. Without logging in: Hard refresh /signin or /simple-login. Verify that the console is clean, with no PostHog 401/404 errors or /opsboard/users/me 401 errors.
  2. After logging in: Log in as a user. Verify that the application functions normally and that relevant requests (including /opsboard/users/me) are made without the previous noise.
  3. (Optional) Enable PostHog in dev: Set NEXT_PUBLIC_ENABLE_POSTHOG_IN_DEV=true in .env.local and provide PostHog keys. Verify PostHog initializes and sends events in dev mode.

Open in Cursor Open in Web

areibman avatar Sep 10 '25 06:09 areibman

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch. Learn more about Cursor Agents

cursor[bot] avatar Sep 10 '25 06:09 cursor[bot]