mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
fix(core): Fix Sentry error reporting on task runners (#12495)
This commit is contained in:
@@ -2,9 +2,9 @@ import { Config, Env } from '@n8n/config';
|
||||
|
||||
@Config
|
||||
export class SentryConfig {
|
||||
/** Sentry DSN */
|
||||
/** Sentry DSN (data source name) */
|
||||
@Env('N8N_SENTRY_DSN')
|
||||
sentryDsn: string = '';
|
||||
dsn: string = '';
|
||||
|
||||
//#region Metadata about the environment
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ describe('JsTaskRunner', () => {
|
||||
...jsRunnerOpts,
|
||||
},
|
||||
sentryConfig: {
|
||||
sentryDsn: '',
|
||||
dsn: '',
|
||||
deploymentName: '',
|
||||
environment: '',
|
||||
n8nVersion: '',
|
||||
|
||||
@@ -54,10 +54,19 @@ void (async function start() {
|
||||
defaultTimezone: config.baseRunnerConfig.timezone,
|
||||
});
|
||||
|
||||
if (config.sentryConfig.sentryDsn) {
|
||||
const { dsn } = config.sentryConfig;
|
||||
|
||||
if (dsn) {
|
||||
const { ErrorReporter } = await import('n8n-core');
|
||||
errorReporter = Container.get(ErrorReporter);
|
||||
await errorReporter.init('task_runner', config.sentryConfig.sentryDsn);
|
||||
const { deploymentName, environment, n8nVersion } = config.sentryConfig;
|
||||
await errorReporter.init({
|
||||
serverType: 'task_runner',
|
||||
dsn,
|
||||
serverName: deploymentName,
|
||||
environment,
|
||||
release: n8nVersion,
|
||||
});
|
||||
}
|
||||
|
||||
runner = new JsTaskRunner(config);
|
||||
|
||||
Reference in New Issue
Block a user