diff --git a/docs/content/en/sentry/options.md b/docs/content/en/sentry/options.md index 6c7ca699..c924ce55 100644 --- a/docs/content/en/sentry/options.md +++ b/docs/content/en/sentry/options.md @@ -189,8 +189,10 @@ Normally, just setting DSN would be enough. } ``` - Sentry by default also enables these browser integrations: `InboundFilters`, `FunctionToString`, `TryCatch`, `Breadcrumbs`, `GlobalHandlers`, `LinkedErrors`, `UserAgent`. Their options can be overridden by specifying them manually in the object. + - Here is the list of client integrations that are supported: `Breadcrumbs`, `CaptureConsole`, `Debug`, `Dedupe`, `ExtraErrorData`, `FunctionToString`, `GlobalHandlers`, `InboundFilters`, `LinkedErrors`, `ReportingObserver`, `RewriteFrames`, `TryCatch`, `UserAgent`, `Vue`. - See https://docs.sentry.io/platforms/javascript/configuration/integrations/default/ and https://docs.sentry.io/platforms/javascript/configuration/integrations/plugin/ for more information on configuring integrations + ### serverIntegrations - Type: `Dictionary` - Default: @@ -202,6 +204,7 @@ Normally, just setting DSN would be enough. Transaction: {} } ``` + - Here is a list of server integrations that are supported: `CaptureConsole`, `Debug`, `Dedupe`, `ExtraErrorData`, `RewriteFrames`, `Modules`, `Transaction`. - See https://docs.sentry.io/platforms/node/pluggable-integrations/ for more information ### tracing diff --git a/lib/core/hooks.js b/lib/core/hooks.js index 2f9506d1..bd9c10d5 100644 --- a/lib/core/hooks.js +++ b/lib/core/hooks.js @@ -6,8 +6,9 @@ import WebpackPlugin from '@sentry/webpack-plugin' import { canInitialize, clientSentryEnabled, serverSentryEnabled } from './utils' const SERVER_CONFIG_FILENAME = 'sentry.server.config.js' -const SENTRY_DEFAULT_INTEGRATIONS = ['Dedupe', 'ExtraErrorData', 'ReportingObserver', 'RewriteFrames', 'Vue'] +const SENTRY_PLUGGABLE_INTEGRATIONS = ['CaptureConsole', 'Debug', 'Dedupe', 'ExtraErrorData', 'ReportingObserver', 'RewriteFrames', 'Vue'] const SENTRY_BROWSER_INTEGRATIONS = ['InboundFilters', 'FunctionToString', 'TryCatch', 'Breadcrumbs', 'GlobalHandlers', 'LinkedErrors', 'UserAgent'] +const SENTRY_SERVER_INTEGRATIONS = ['CaptureConsole', 'Debug', 'Dedupe', 'ExtraErrorData', 'RewriteFrames', 'Modules', 'Transaction'] /** @param {import('../../types/sentry').IntegrationsConfiguration} integrations */ const filterDisabledIntegration = integrations => Object.keys(integrations).filter(key => integrations[key]) @@ -103,12 +104,19 @@ export async function buildHook (moduleContainer, options, logger) { } for (const name of Object.keys(options.clientIntegrations)) { - if (!SENTRY_DEFAULT_INTEGRATIONS.includes(name) && !SENTRY_BROWSER_INTEGRATIONS.includes(name)) { - logger.warn(`Sentry integration "${name}" is not recognized and will be ignored.`) + if (!SENTRY_PLUGGABLE_INTEGRATIONS.includes(name) && !SENTRY_BROWSER_INTEGRATIONS.includes(name)) { + logger.warn(`Sentry clientIntegration "${name}" is not recognized and will be ignored.`) delete options.clientIntegrations[name] } } + for (const name of Object.keys(options.serverIntegrations)) { + if (!SENTRY_SERVER_INTEGRATIONS.includes(name)) { + logger.warn(`Sentry serverIntegration "${name}" is not recognized and will be ignored.`) + delete options.serverIntegrations[name] + } + } + // Register the client plugin const pluginOptionClient = clientSentryEnabled(options) ? (options.lazy ? 'lazy' : 'client') : 'mocked' moduleContainer.addPlugin({ @@ -116,7 +124,7 @@ export async function buildHook (moduleContainer, options, logger) { fileName: 'sentry.client.js', mode: 'client', options: { - SENTRY_DEFAULT_INTEGRATIONS, + SENTRY_PLUGGABLE_INTEGRATIONS, SENTRY_BROWSER_INTEGRATIONS, dev: moduleContainer.options.dev, runtimeConfigKey: options.runtimeConfigKey, diff --git a/lib/plugin.client.js b/lib/plugin.client.js index 61f1d058..f6a8edc7 100644 --- a/lib/plugin.client.js +++ b/lib/plugin.client.js @@ -3,7 +3,7 @@ import merge from 'lodash.merge' import * as Sentry from '@sentry/browser' <% if (options.initialize) { - let integrations = options.SENTRY_DEFAULT_INTEGRATIONS.filter(key => key in options.integrations) + let integrations = options.SENTRY_PLUGGABLE_INTEGRATIONS.filter(key => key in options.integrations) if (integrations.length) {%>import { <%= integrations.join(', ') %> } from '@sentry/integrations' <%} integrations = options.SENTRY_BROWSER_INTEGRATIONS.filter(key => key in options.integrations) diff --git a/lib/plugin.lazy.js b/lib/plugin.lazy.js index 52df1845..701f3603 100644 --- a/lib/plugin.lazy.js +++ b/lib/plugin.lazy.js @@ -114,7 +114,7 @@ async function loadSentry (ctx, inject) { const Sentry = await import(/* <%= magicComments.join(', ') %> */ '@sentry/browser') <% if (options.initialize) { - let integrations = options.SENTRY_DEFAULT_INTEGRATIONS.filter(key => key in options.integrations) + let integrations = options.SENTRY_PLUGGABLE_INTEGRATIONS.filter(key => key in options.integrations) if (integrations.length) {%>const { <%= integrations.join(', ') %> } = await import(/* <%= magicComments.join(', ') %> */ '@sentry/integrations') <% } integrations = options.SENTRY_BROWSER_INTEGRATIONS.filter(key => key in options.integrations)