Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade to @sentry/browser 8 #467

Merged
merged 2 commits into from
May 21, 2024
Merged

Conversation

Slessi
Copy link
Contributor

@Slessi Slessi commented May 14, 2024

Fixes #466

https://docs.sentry.io/platforms/javascript/migration/v7-to-v8/#removal-of-sentryconfigurescope-method

The top level Sentry.configureScope function has been removed. Instead, you should use the Sentry.getCurrentScope() to access and mutate the current scope.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Figuring out how to fix some tests here still ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not familiar with this sentry-testkit thing but it seems that whilst all tests pass individually, when the whole suite runs they conflict with each other as testkit.reports contains data from other tests.

@spawnia would you know anything about that?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that their API has not changed, see https://zivl.github.io/sentry-testkit/docs/getting-started#reset-between-tests. Perhaps we need to upgrade to the latest version, see https://github.com/zivl/sentry-testkit/tags?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea that was the first place I looked. I tried it locally, as it did not have an effect I did not commit it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no other ideas. Let me know when you have a fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I filed an issue with them zivl/sentry-testkit#200

I assume that is the problem

@spawnia spawnia changed the title fix: suggest @sentry/browser:^8.0.0 as peer dependency feat: upgrade to @sentry/browser 8 May 16, 2024
@spawnia spawnia marked this pull request as draft May 16, 2024 09:53
});
const scope = Sentry.getCurrentScope();

scope.clearBreadcrumbs();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The addBreadcrumb function adds breadcrumbs to the isolation scope so you'll need clear them from there instead

Sentry.getIsolationScope().clearBreadcrumbs();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well that was non-obvious, but seems to fix the tests, nice

@Slessi Slessi marked this pull request as ready for review May 20, 2024 18:31
@Slessi Slessi requested a review from spawnia May 20, 2024 18:31
@spawnia spawnia added the enhancement New feature or request label May 21, 2024
@spawnia spawnia merged commit 08c48a4 into DiederikvandenB:master May 21, 2024
4 checks passed
Copy link

🎉 This PR is included in version 4.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Slessi Slessi deleted the v8-upgrade branch May 21, 2024 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sentry v8 compatibility
3 participants