agentops
agentops copied to clipboard
Fix local development console errors
📥 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
developmentorlocal. - Adding checks to
PostHogUserIdentifierto only interact with PostHog if it's loaded. - Skipping
/opsboard/users/meAPI calls when nosession_idcookie is present in bothuseUserand 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/mecalls are not made when nosession_idcookie 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.
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