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
In the current version of Sentry, they have changed their Integration type. In the current state, when trying to add the Posthog Integration to Sentry it's throwing an error:
A couple other users on the PostHog integration page have also been running into this issue mentioned by Ariel and Vitor.
This is related to two breaking changes in Sentry's updated Integration:
setupOnce()
method no longer passes any functions.getCurrentHub()
is being deprecatedThe PostHog sentry-integration now needs a different way to get the projectId and add events coming from Sentry, which are used in capture events in posthog.
Last thing I'll say is that this is my first open source contribution! So apologies if something is messy or not right :) Please let me know if there's anything I can improve!
Changes
Since the method
setupOnce()
no longer passes the current functions used for events and hub, we need to usesetup()
which passes the Sentryclient()
class. Using that class, we have access toaddEventProcessor(event)
function andgetDsn().projectId
that was previously being used. That satisfies the information needed by PostHog.We also no longer need the specific _SentryIntegration interface.
I've also updated the tests to account for the new
setup()
class with theaddEventProcessor()
function. It's currently passing on my local machine.Release info Sub-libraries affected
As noted in the integration, we don't import
@sentry/types
, but the latest ones were used to check everything in development.Bump level
Libraries affected
Changelog notes