agentops icon indicating copy to clipboard operation
agentops copied to clipboard

Fix local development console errors

Open areibman opened this issue 3 months ago • 1 comments

📥 Pull Request

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

  • Disabling PostHog initialization unless a key is present and the environment is not development or local.
  • Adding checks to PostHogUserIdentifier to only interact with PostHog if it's loaded.
  • Skipping /opsboard/users/me API calls when no session_id cookie is present in both useUser and the sign-in form.
  • Reducing console logging for expected 401/403 authentication errors in non-production environments.

These changes prevent unnecessary network requests and console spam (e.g., 401/404 errors, JSON MIME errors) when working locally without a fully configured backend or analytics.

🧪 Testing I ran the application locally and verified the following:

  • PostHog-related 401/404 errors and JSON MIME errors are no longer present in the console.
  • /opsboard/users/me calls are not made when no session_id cookie exists.
  • Expected 401/403 API errors are now logged as warnings or suppressed in local mode, rather than noisy console errors.
  • Authentication and user fetching still function correctly when a valid session is present.

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]