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

fix(core): Add guard against scope.getAttachments #6258

Merged
merged 1 commit into from Nov 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/core/src/baseclient.ts
Expand Up @@ -437,7 +437,12 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {

// This should be the last thing called, since we want that
// {@link Hub.addEventProcessor} gets the finished prepared event.
if (finalScope) {
//
// We need to check for the existence of `finalScope.getAttachments`
// because `getAttachments` can be undefined if users are using an older version
// of `@sentry/core` that does not have the `getAttachments` method.
// See: https://github.com/getsentry/sentry-javascript/issues/5229
if (finalScope && finalScope.getAttachments) {
// Collect attachments from the hint and scope
const attachments = [...(hint.attachments || []), ...finalScope.getAttachments()];

Expand Down