Skip to content

Commit 89a4d42

Browse files
authored
feat: Move LinkedErrors integration to @sentry/core (#9404)
- Remove LinkedErrors from Node SDK and use Core SDK LinkedErrors instead - Use LinkedErrors integration in Vercel Edge SDK - Update Deno SDK to use LinkedErrors integration from Core instead of Browser In a future PR I'm going to remove browser specific `LinkedErrors` integration and make everything rely on implementation in Core SDK. This refactor came from two places 1. We noticed the Deno SDK relies on the browser SDK. This is not ideal, so this helps with that 2. We got feedback via customer that `LinkedErrors` was not available in `@sentry/vercel-edge`
1 parent 4fc18b9 commit 89a4d42

File tree

11 files changed

+17
-17
lines changed

11 files changed

+17
-17
lines changed

packages/bun/src/sdk.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const defaultIntegrations = [
1111
// Common
1212
new CoreIntegrations.InboundFilters(),
1313
new CoreIntegrations.FunctionToString(),
14+
new CoreIntegrations.LinkedErrors(),
1415
// Native Wrappers
1516
new NodeIntegrations.Console(),
1617
new NodeIntegrations.Http(),
@@ -24,8 +25,6 @@ export const defaultIntegrations = [
2425
new NodeIntegrations.Context(),
2526
new NodeIntegrations.Modules(),
2627
new NodeIntegrations.RequestData(),
27-
// Misc
28-
new NodeIntegrations.LinkedErrors(),
2928
// Bun Specific
3029
new BunServer(),
3130
];

packages/core/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export { makeOfflineTransport } from './transports/offline';
4848
export { makeMultiplexedTransport } from './transports/multiplexed';
4949
export { SDK_VERSION } from './version';
5050
export { getIntegrationsToSetup, addIntegration } from './integration';
51-
export { FunctionToString, InboundFilters } from './integrations';
51+
export { FunctionToString, InboundFilters, LinkedErrors } from './integrations';
5252
export { prepareEvent } from './utils/prepareEvent';
5353
export { createCheckInEnvelope } from './checkin';
5454
export { hasTracingEnabled } from './utils/hasTracingEnabled';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export { FunctionToString } from './functiontostring';
22
export { InboundFilters } from './inboundfilters';
3+
export { LinkedErrors } from './linkederrors';

packages/node/src/integrations/linkederrors.ts renamed to packages/core/src/integrations/linkederrors.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class LinkedErrors implements Integration {
1414
/**
1515
* @inheritDoc
1616
*/
17-
public readonly name: string = LinkedErrors.id;
17+
public readonly name: string;
1818

1919
/**
2020
* @inheritDoc
@@ -32,6 +32,7 @@ export class LinkedErrors implements Integration {
3232
public constructor(options: { key?: string; limit?: number } = {}) {
3333
this._key = options.key || DEFAULT_KEY;
3434
this._limit = options.limit || DEFAULT_LIMIT;
35+
this.name = LinkedErrors.id;
3536
}
3637

3738
/** @inheritdoc */

packages/deno/src/sdk.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Breadcrumbs, Dedupe, LinkedErrors } from '@sentry/browser';
1+
import { Breadcrumbs, Dedupe } from '@sentry/browser';
22
import type { ServerRuntimeClientOptions } from '@sentry/core';
33
import { getIntegrationsToSetup, initAndBind, Integrations as CoreIntegrations } from '@sentry/core';
44
import type { StackParser } from '@sentry/types';
@@ -13,9 +13,9 @@ export const defaultIntegrations = [
1313
// Common
1414
new CoreIntegrations.InboundFilters(),
1515
new CoreIntegrations.FunctionToString(),
16+
new CoreIntegrations.LinkedErrors(),
1617
// From Browser
1718
new Dedupe(),
18-
new LinkedErrors(),
1919
new Breadcrumbs({
2020
dom: false,
2121
history: false,

packages/deno/test/__snapshots__/mod.test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ snapshot[`captureException 1`] = `
140140
integrations: [
141141
"InboundFilters",
142142
"FunctionToString",
143-
"Dedupe",
144143
"LinkedErrors",
144+
"Dedupe",
145145
"Breadcrumbs",
146146
"DenoContext",
147147
"ContextLines",
@@ -200,8 +200,8 @@ snapshot[`captureMessage 1`] = `
200200
integrations: [
201201
"InboundFilters",
202202
"FunctionToString",
203-
"Dedupe",
204203
"LinkedErrors",
204+
"Dedupe",
205205
"Breadcrumbs",
206206
"DenoContext",
207207
"ContextLines",

packages/node-experimental/src/integrations/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const {
44
Console,
55
OnUncaughtException,
66
OnUnhandledRejection,
7-
LinkedErrors,
87
Modules,
98
ContextLines,
109
Context,
@@ -16,7 +15,6 @@ export {
1615
Console,
1716
OnUncaughtException,
1817
OnUnhandledRejection,
19-
LinkedErrors,
2018
Modules,
2119
ContextLines,
2220
Context,

packages/node/src/integrations/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ export { Console } from './console';
22
export { Http } from './http';
33
export { OnUncaughtException } from './onuncaughtexception';
44
export { OnUnhandledRejection } from './onunhandledrejection';
5-
export { LinkedErrors } from './linkederrors';
65
export { Modules } from './modules';
76
export { ContextLines } from './contextlines';
87
export { Context } from './context';

packages/node/src/sdk.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
Context,
2424
ContextLines,
2525
Http,
26-
LinkedErrors,
2726
LocalVariables,
2827
Modules,
2928
OnUncaughtException,
@@ -39,6 +38,7 @@ export const defaultIntegrations = [
3938
// Common
4039
new CoreIntegrations.InboundFilters(),
4140
new CoreIntegrations.FunctionToString(),
41+
new CoreIntegrations.LinkedErrors(),
4242
// Native Wrappers
4343
new Console(),
4444
new Http(),
@@ -52,8 +52,6 @@ export const defaultIntegrations = [
5252
new Context(),
5353
new Modules(),
5454
new RequestData(),
55-
// Misc
56-
new LinkedErrors(),
5755
];
5856

5957
/**

packages/node/test/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getMainCarrier, initAndBind, runWithAsyncContext, SDK_VERSION } from '@sentry/core';
1+
import { getMainCarrier, initAndBind, LinkedErrors, runWithAsyncContext, SDK_VERSION } from '@sentry/core';
22
import type { EventHint, Integration } from '@sentry/types';
33

44
import type { Event, Scope } from '../src';
@@ -13,7 +13,7 @@ import {
1313
NodeClient,
1414
} from '../src';
1515
import { setNodeAsyncContextStrategy } from '../src/async';
16-
import { ContextLines, LinkedErrors } from '../src/integrations';
16+
import { ContextLines } from '../src/integrations';
1717
import { defaultStackParser } from '../src/sdk';
1818
import type { NodeClientOptions } from '../src/types';
1919
import { getDefaultNodeClientOptions } from './helper/node-client-options';

packages/vercel-edge/src/sdk.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ declare const process: {
1313

1414
const nodeStackParser = createStackParser(nodeStackLineParser());
1515

16-
export const defaultIntegrations = [new CoreIntegrations.InboundFilters(), new CoreIntegrations.FunctionToString()];
16+
export const defaultIntegrations = [
17+
new CoreIntegrations.InboundFilters(),
18+
new CoreIntegrations.FunctionToString(),
19+
new CoreIntegrations.LinkedErrors(),
20+
];
1721

1822
/** Inits the Sentry NextJS SDK on the Edge Runtime. */
1923
export function init(options: VercelEdgeOptions = {}): void {

0 commit comments

Comments
 (0)