Skip to content

Commit

Permalink
chore(core): Upgrade backend @sentry packages to 8.42.0 (#12061)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomi authored Dec 10, 2024
1 parent 43009b6 commit db09d0e
Show file tree
Hide file tree
Showing 10 changed files with 705 additions and 108 deletions.
1 change: 0 additions & 1 deletion packages/@n8n/task-runner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
},
"dependencies": {
"@n8n/config": "workspace:*",
"@sentry/integrations": "catalog:",
"@sentry/node": "catalog:",
"acorn": "8.14.0",
"acorn-walk": "8.3.4",
Expand Down
14 changes: 10 additions & 4 deletions packages/@n8n/task-runner/src/error-reporter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { RewriteFrames } from '@sentry/integrations';
import { init, setTag, captureException, close } from '@sentry/node';
import type { ErrorEvent, EventHint } from '@sentry/types';
import {
init,
setTag,
captureException,
close,
rewriteFramesIntegration,
type EventHint,
type ErrorEvent,
} from '@sentry/node';
import * as a from 'assert/strict';
import { createHash } from 'crypto';
import { ApplicationError } from 'n8n-workflow';
Expand Down Expand Up @@ -52,7 +58,7 @@ export class ErrorReporter {
beforeSend: async (event, hint) => await this.beforeSend(event, hint),
integrations: (integrations) => [
...integrations.filter(({ name }) => ENABLED_INTEGRATIONS.includes(name)),
new RewriteFrames({ root: process.cwd() }),
rewriteFramesIntegration({ root: process.cwd() }),
],
});

Expand Down
1 change: 0 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
"@n8n_io/license-sdk": "2.13.1",
"@oclif/core": "4.0.7",
"@rudderstack/rudder-sdk-node": "2.0.9",
"@sentry/integrations": "catalog:",
"@sentry/node": "catalog:",
"aws4": "1.11.0",
"axios": "catalog:",
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/__tests__/error-reporting.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { InternalServerError } from '@/errors/response-errors/internal-server.er

const init = jest.fn();

jest.mock('@sentry/integrations');
jest.mock('@sentry/node', () => ({
init,
setTag: jest.fn(),
Expand Down
7 changes: 2 additions & 5 deletions packages/cli/src/abstract-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,8 @@ export abstract class AbstractServer {
const { app } = this;

// Augment errors sent to Sentry
const {
Handlers: { requestHandler, errorHandler },
} = await import('@sentry/node');
app.use(requestHandler());
app.use(errorHandler());
const { setupExpressErrorHandler } = await import('@sentry/node');
setupExpressErrorHandler(app);
}

private setupCommonMiddlewares() {
Expand Down
7 changes: 3 additions & 4 deletions packages/cli/src/error-reporting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ export const initErrorHandling = async () => {

const { init, captureException, setTag } = await import('@sentry/node');

const { RewriteFrames } = await import('@sentry/integrations');
const { Integrations } = await import('@sentry/node');
const { requestDataIntegration, rewriteFramesIntegration } = await import('@sentry/node');

const enabledIntegrations = [
'InboundFilters',
Expand All @@ -54,8 +53,8 @@ export const initErrorHandling = async () => {
beforeBreadcrumb: () => null,
integrations: (integrations) => [
...integrations.filter(({ name }) => enabledIntegrations.includes(name)),
new RewriteFrames({ root: process.cwd() }),
new Integrations.RequestData({
rewriteFramesIntegration({ root: process.cwd() }),
requestDataIntegration({
include: {
cookies: false,
data: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class MessageEventBusDestinationSentry
environment,
release: N8N_VERSION,
transport: Sentry.makeNodeTransport,
integrations: Sentry.defaultIntegrations,
integrations: Sentry.getDefaultIntegrations({}),
stackParser: Sentry.defaultStackParser,
});
}
Expand Down
7 changes: 2 additions & 5 deletions packages/cli/src/runners/task-runner-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,8 @@ export class TaskRunnerServer {

// Augment errors sent to Sentry
if (this.globalConfig.sentry.backendDsn) {
const {
Handlers: { requestHandler, errorHandler },
} = await import('@sentry/node');
app.use(requestHandler());
app.use(errorHandler());
const { setupExpressErrorHandler } = await import('@sentry/node');
setupExpressErrorHandler(app);
}
}

Expand Down
Loading

0 comments on commit db09d0e

Please sign in to comment.