Fix: Drop analytics events from local development - #364
Draft
posthog-eu[bot] wants to merge 1 commit into
Draft
posthog-eu[bot] wants to merge 1 commit into
posthog-eu[bot] wants to merge 1 commit into
Conversation
The `before_send` hook stamped `deployment_env` on every event but never dropped anything, so a developer's local errors and activity reached production analytics the same as real user events. This caused localhost-only exceptions to surface in error tracking as if they were incidents. Drop the event in `before_send` when the deployment environment is development or the current host is localhost. Generated-By: PostHog Desktop Task-Id: d34abe68-0e76-4193-b1d4-97dc5383e28a
Contributor
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
before_sendhook inpackages/observability/src/initAnalytics.tsstamps adeployment_envproperty on every event but never drops anything. A developer's local errors are captured exactly like production ones.importWithRetryinpackages/lib/src/preloader.tsthrewFailed to load module after 5 attemptsbecause the slides plugin bundle was not served by the local dev server — expected during development, but captured all the same.Changes
before_sendnow returnsnull(drops the event) when the run is local development, before any event leaves the browser.development, orlocalhost,127.0.0.1,0.0.0.0,::1, or any.localhost).Notes
yarn buildproduces the ESM/CJS output; the pre-existingexperimental-dtsrollup warning is unrelated and also present onmain).Created with PostHog Desktop from this inbox report.