fix(core): Inline config.js to index.html to prevent CF from caching it (#18945)

This commit is contained in:
Tomi Turtiainen
2025-09-02 09:58:12 +03:00
committed by GitHub
parent 35e4772210
commit 17ce65a529
9 changed files with 352 additions and 31 deletions

View File

@@ -2,6 +2,7 @@ import type { Plugin } from 'vue';
import { AxiosError } from 'axios';
import { ResponseError } from '@n8n/rest-api-client';
import * as Sentry from '@sentry/vue';
import { getAndParseConfigFromMetaTag } from '@n8n/stores/metaTagConfig';
const ignoredErrors = [
{ instanceof: AxiosError },
@@ -14,6 +15,13 @@ const ignoredErrors = [
{ instanceof: Error, message: /ResizeObserver/ },
] as const;
type SentryConfig = {
dsn?: string;
environment?: string;
serverName?: string;
release?: string;
};
export function beforeSend(event: Sentry.ErrorEvent, { originalException }: Sentry.EventHint) {
if (
!originalException ||
@@ -42,11 +50,12 @@ export function beforeSend(event: Sentry.ErrorEvent, { originalException }: Sent
export const SentryPlugin: Plugin = {
install: (app) => {
if (!window.sentry?.dsn) {
const sentryConfig = getAndParseConfigFromMetaTag<SentryConfig>('sentry');
if (!sentryConfig?.dsn) {
return;
}
const { dsn, release, environment, serverName } = window.sentry;
const { dsn, release, environment, serverName } = sentryConfig;
Sentry.init({
app,

View File

@@ -21,7 +21,6 @@ declare global {
interface Window {
BASE_PATH: string;
REST_ENDPOINT: string;
sentry?: { dsn?: string; environment: string; release: string; serverName?: string };
n8nExternalHooks?: PartialDeep<ExternalHooks>;
preventNodeViewBeforeUnload?: boolean;
maxPinnedDataSize?: number;