feat(editor): Setup Sentry integration (#10945)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-09-24 17:49:22 +02:00
committed by GitHub
parent c75990e063
commit 6de4dfff87
19 changed files with 307 additions and 121 deletions

View File

@@ -1,4 +1,3 @@
import type { FrontendSettings } from '@n8n/api-types';
import cookieParser from 'cookie-parser';
import express from 'express';
import { access as fsAccess } from 'fs/promises';
@@ -21,6 +20,7 @@ import {
import { CredentialsOverwrites } from '@/credentials-overwrites';
import { ControllerRegistry } from '@/decorators';
import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus';
import { EventService } from '@/events/event.service';
import { LogStreamingEventRelay } from '@/events/log-streaming-event-relay';
import type { ICredentialsOverwrite } from '@/interfaces';
import { isLdapEnabled } from '@/ldap/helpers.ee';
@@ -58,12 +58,12 @@ import '@/controllers/user-settings.controller';
import '@/controllers/workflow-statistics.controller';
import '@/credentials/credentials.controller';
import '@/eventbus/event-bus.controller';
import '@/events/events.controller';
import '@/executions/executions.controller';
import '@/external-secrets/external-secrets.controller.ee';
import '@/license/license.controller';
import '@/workflows/workflow-history/workflow-history.controller.ee';
import '@/workflows/workflows.controller';
import { EventService } from './events/event.service';
@Service()
export class Server extends AbstractServer {
@@ -169,10 +169,6 @@ export class Server extends AbstractServer {
const { frontendService } = this;
if (frontendService) {
frontendService.addToSettings({
versionCli: N8N_VERSION,
});
await this.externalHooks.run('frontend.settings', [frontendService.getSettings()]);
}
@@ -244,11 +240,22 @@ export class Server extends AbstractServer {
// Returns the current settings for the UI
this.app.get(
`/${this.restEndpoint}/settings`,
ResponseHelper.send(
async (req: express.Request): Promise<FrontendSettings> =>
frontendService.getSettings(req.headers['push-ref'] as string),
),
ResponseHelper.send(async () => frontendService.getSettings()),
);
// Return Sentry config as a static file
this.app.get(`/${this.restEndpoint}/sentry.js`, (_, res) => {
res.type('js');
res.write('window.sentry=');
res.write(
JSON.stringify({
dsn: this.globalConfig.sentry.frontendDsn,
environment: process.env.ENVIRONMENT || 'development',
release: N8N_VERSION,
}),
);
res.end();
});
}
// ----------------------------------------