toucan-js icon indicating copy to clipboard operation
toucan-js copied to clipboard

RewriteFrames from @sentry/integrations >= 7.74.0 is no longer compatible with toucan-js

Open olivierbeaulieu opened this issue 1 year ago • 5 comments

Using from the RewriteFrames the latest @sentry/integrations no longer works. The integration's processEvent is never called.

I believe this is because of a recent refactoring from Sentry where the integration's setupOnce become a noop (source)

Toucan depends on setupOnce calling the function that is passed to it, otherwise the event processor is never added to the SDK's scope (source).

olivierbeaulieu avatar Dec 12 '23 22:12 olivierbeaulieu

If you use a version of @sentry/integrations that matches the the one in use in toucan-js (ie. v7.76.0), you should not see this issue as the APIs will match.

Once this auto-generated PR is merged and a release cut, you'll be able to use newer versions.

timfish avatar Dec 12 '23 23:12 timfish

Aligning sentry versions didn't work for me.

RewriteFrames from v.7.76.0 has the noop setupOnce, which [email protected] expects to not be a noop. Unless I'm misunderstanding something?

Thanks!

olivierbeaulieu avatar Dec 13 '23 01:12 olivierbeaulieu

Ah yes sorry you are correct, I didn't realise setupIntegrations was overridden in the client. I guess this code need to be copied from Sentry core: https://github.com/getsentry/sentry-javascript/blob/7303cdacb3ba2da1e71844e9daa5ffdb91d9a8a7/packages/core/src/integration.ts#L106-L130

timfish avatar Dec 13 '23 08:12 timfish

Bumped into this as well – took me more than a day of trying to figure it out on Dec 8, a few days before this issue was filed; resumed that work today and found this, thank you for reporting!

FYI the title should be ">= 7.74.0" or "> 7.73.0" – 7.74.0 is the first version with noop setupOnce.

With yarn, the following override in package.json makes it work:

  "resolutions": {
    "toucan-js/@sentry/core": "7.73",
    "toucan-js/@sentry/integrations": "7.73",
    "toucan-js/@sentry/types": "7.73",
    "toucan-js/@sentry/utils": "7.73"
  }

maciejp-ro avatar Jan 11 '24 18:01 maciejp-ro

Issue title updated, good catch.

olivierbeaulieu avatar Jan 16 '24 17:01 olivierbeaulieu

Sentry removed class-based integrations in v8. We just released a new version of Toucan that uses new function-based integrations in https://github.com/robertcepa/toucan-js/releases/tag/toucan-js%404.0.0

Upgrading to v4.0.0 should resolve this problem. Note that RewriteFrames is now called rewriteFramesIntegration.

robertcepa avatar Jul 02 '24 15:07 robertcepa