Open mozeryansky opened 1 month ago
I am able to get it to work by doing this after Sentry.init:
const postHogIntegration = new posthog.SentryIntegration(
posthog,
'your organization',
project-id,
undefined, // optional: but necessary if you want to set a severity allowlist
['error', 'info'] // optional: here is set to handle captureMessage (info) and captureException (error)
)
postHogIntegration.setupOnce(Sentry.addEventProcessor, () => {})
Essentially passing the handler inside setupOnce to the addEventProcessor.
However, another issue is that the urls being generated are incorrect. The config token here is the API key, but Sentry uses a the project ID (i.e. 80397).
const personUrl = _posthog.requestRouter.endpointFor(
'ui',
`/project/${_posthog.config.token}/person/${_posthog.get_distinct_id()}` // <--- wrong url
)
Following the instructions from here: https://posthog.com/docs/libraries/sentry#installation
The
SentryIntegration
class is not type compatible. Force casting throws causing an error from sentry for the same reason.Turns out Sentry recently changed the signature: https://github.com/getsentry/sentry-javascript/pull/11238