@sentry/nuxt 10.38.0 → 10.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,10 +9,11 @@ const core = require('@sentry/core');
9
9
  * @param options Configuration options for the SDK.
10
10
  */
11
11
  function init(options) {
12
+ const envFallback = undefined ? core.DEV_ENVIRONMENT : core.DEFAULT_ENVIRONMENT;
12
13
  const sentryOptions = {
13
14
  /* BrowserTracing is added later with the Nuxt client plugin */
14
15
  defaultIntegrations: [...browser.getDefaultIntegrations(options)],
15
- environment: undefined ? core.DEV_ENVIRONMENT : core.DEFAULT_ENVIRONMENT,
16
+ environment: options.environment ?? process.env.SENTRY_ENVIRONMENT ?? envFallback,
16
17
  ...options,
17
18
  };
18
19
 
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sources":["../../../src/client/sdk.ts"],"sourcesContent":["import { getDefaultIntegrations as getBrowserDefaultIntegrations, init as initBrowser } from '@sentry/browser';\nimport type { Client } from '@sentry/core';\nimport { applySdkMetadata, DEFAULT_ENVIRONMENT, DEV_ENVIRONMENT } from '@sentry/core';\nimport type { SentryNuxtClientOptions } from '../common/types';\n\n/**\n * Initializes the client-side of the Nuxt SDK\n *\n * @param options Configuration options for the SDK.\n */\nexport function init(options: SentryNuxtClientOptions): Client | undefined {\n const sentryOptions = {\n /* BrowserTracing is added later with the Nuxt client plugin */\n defaultIntegrations: [...getBrowserDefaultIntegrations(options)],\n environment: import.meta.dev ? DEV_ENVIRONMENT : DEFAULT_ENVIRONMENT,\n ...options,\n };\n\n applySdkMetadata(sentryOptions, 'nuxt', ['nuxt', 'vue']);\n\n return initBrowser(sentryOptions);\n}\n"],"names":["getBrowserDefaultIntegrations","DEV_ENVIRONMENT","DEFAULT_ENVIRONMENT","applySdkMetadata","initBrowser"],"mappings":";;;;;AAKA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAA+C;AAC3E,EAAE,MAAM,gBAAgB;AACxB;AACA,IAAI,mBAAmB,EAAE,CAAC,GAAGA,8BAA6B,CAAC,OAAO,CAAC,CAAC;AACpE,IAAI,WAAW,EAAE,SAAY,GAAMC,oBAAA,GAAkBC,wBAAmB;AACxE,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAEC,qBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;;AAE1D,EAAE,OAAOC,YAAW,CAAC,aAAa,CAAC;AACnC;;;;"}
1
+ {"version":3,"file":"sdk.js","sources":["../../../src/client/sdk.ts"],"sourcesContent":["import { getDefaultIntegrations as getBrowserDefaultIntegrations, init as initBrowser } from '@sentry/browser';\nimport type { Client } from '@sentry/core';\nimport { applySdkMetadata, DEFAULT_ENVIRONMENT, DEV_ENVIRONMENT } from '@sentry/core';\nimport type { SentryNuxtClientOptions } from '../common/types';\n\n/**\n * Initializes the client-side of the Nuxt SDK\n *\n * @param options Configuration options for the SDK.\n */\nexport function init(options: SentryNuxtClientOptions): Client | undefined {\n const envFallback = import.meta.dev ? DEV_ENVIRONMENT : DEFAULT_ENVIRONMENT;\n const sentryOptions = {\n /* BrowserTracing is added later with the Nuxt client plugin */\n defaultIntegrations: [...getBrowserDefaultIntegrations(options)],\n environment: options.environment ?? process.env.SENTRY_ENVIRONMENT ?? envFallback,\n ...options,\n };\n\n applySdkMetadata(sentryOptions, 'nuxt', ['nuxt', 'vue']);\n\n return initBrowser(sentryOptions);\n}\n"],"names":["DEV_ENVIRONMENT","DEFAULT_ENVIRONMENT","getBrowserDefaultIntegrations","applySdkMetadata","initBrowser"],"mappings":";;;;;AAKA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAA+C;AAC3E,EAAE,MAAM,WAAA,GAAc,SAAY,GAAMA,oBAAA,GAAkBC,wBAAmB;AAC7E,EAAE,MAAM,gBAAgB;AACxB;AACA,IAAI,mBAAmB,EAAE,CAAC,GAAGC,8BAA6B,CAAC,OAAO,CAAC,CAAC;AACpE,IAAI,WAAW,EAAE,OAAO,CAAC,WAAA,IAAe,OAAO,CAAC,GAAG,CAAC,kBAAA,IAAsB,WAAW;AACrF,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAEC,qBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;;AAE1D,EAAE,OAAOC,YAAW,CAAC,aAAa,CAAC;AACnC;;;;"}
@@ -108,7 +108,7 @@ const module$1 = kit.defineNuxtModule({
108
108
  if (serverConfigFile) {
109
109
  middlewareConfig.addMiddlewareImports();
110
110
  storageConfig.addStorageInstrumentation(nuxt);
111
- databaseConfig.addDatabaseInstrumentation(nuxt.options.nitro);
111
+ databaseConfig.addDatabaseInstrumentation(nuxt.options.nitro, moduleOptions);
112
112
  }
113
113
 
114
114
  // Add the sentry config file to the include array
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sources":["../../src/module.ts"],"sourcesContent":["import {\n addPlugin,\n addPluginTemplate,\n addServerPlugin,\n addTemplate,\n createResolver,\n defineNuxtModule,\n} from '@nuxt/kit';\nimport { consoleSandbox } from '@sentry/core';\nimport * as path from 'path';\nimport type { SentryNuxtModuleOptions } from './common/types';\nimport { addDynamicImportEntryFileWrapper, addSentryTopImport, addServerConfigToBuild } from './vite/addServerConfig';\nimport { addDatabaseInstrumentation } from './vite/databaseConfig';\nimport { addMiddlewareImports, addMiddlewareInstrumentation } from './vite/middlewareConfig';\nimport { setupSourceMaps } from './vite/sourceMaps';\nimport { addStorageInstrumentation } from './vite/storageConfig';\nimport { addOTelCommonJSImportAlias, findDefaultSdkInitFile } from './vite/utils';\n\nexport type ModuleOptions = SentryNuxtModuleOptions;\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@sentry/nuxt/module',\n configKey: 'sentry',\n compatibility: {\n nuxt: '>=3.7.0',\n },\n },\n defaults: {},\n setup(moduleOptionsParam, nuxt) {\n if (moduleOptionsParam?.enabled === false) {\n return;\n }\n\n const moduleOptions = {\n ...moduleOptionsParam,\n autoInjectServerSentry: moduleOptionsParam.autoInjectServerSentry,\n experimental_entrypointWrappedFunctions: moduleOptionsParam.experimental_entrypointWrappedFunctions || [\n 'default',\n 'handler',\n 'server',\n ],\n };\n\n const moduleDirResolver = createResolver(import.meta.url);\n const buildDirResolver = createResolver(nuxt.options.buildDir);\n\n const clientConfigFile = findDefaultSdkInitFile('client', nuxt);\n\n if (clientConfigFile) {\n // Inject the client-side Sentry config file with a side effect import\n addPluginTemplate({\n mode: 'client',\n filename: 'sentry-client-config.mjs',\n order: 0,\n\n // Dynamic import of config file to wrap it within a Nuxt context (here: defineNuxtPlugin)\n // Makes it possible to call useRuntimeConfig() in the user-defined sentry config file\n getContents: () => `\n import { defineNuxtPlugin } from \"#imports\";\n\n export default defineNuxtPlugin({\n name: 'sentry-client-config',\n async setup() {\n await import(\"${buildDirResolver.resolve(`/${clientConfigFile}`)}\")\n }\n });`,\n });\n\n // Add the plugin which loads client integrations etc. -\n // this must run after the sentry-client-config plugin has run, and the client is initialized!\n addPlugin({\n src: moduleDirResolver.resolve('./runtime/plugins/sentry.client'),\n mode: 'client',\n order: 1,\n });\n }\n\n const serverConfigFile = findDefaultSdkInitFile('server', nuxt);\n\n if (serverConfigFile) {\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/sentry.server'));\n\n addPlugin({\n src: moduleDirResolver.resolve('./runtime/plugins/route-detector.server'),\n mode: 'server',\n });\n }\n\n if (clientConfigFile || serverConfigFile) {\n setupSourceMaps(moduleOptions, nuxt);\n }\n\n addOTelCommonJSImportAlias(nuxt);\n\n const pagesDataTemplate = addTemplate({\n filename: 'sentry--nuxt-pages-data.mjs',\n // Initial empty array (later filled in pages:extend hook)\n // Template needs to be created in the root-level of the module to work\n getContents: () => 'export default [];',\n });\n\n nuxt.hooks.hook('pages:extend', pages => {\n pagesDataTemplate.getContents = () => {\n const pagesSubset = pages\n .map(page => ({ file: page.file, path: page.path }))\n .filter(page => {\n // Check for dynamic parameter (e.g., :userId or [userId])\n return page.path.includes(':') || page?.file?.includes('[');\n });\n\n return `export default ${JSON.stringify(pagesSubset, null, 2)};`;\n };\n });\n\n // Preps the the middleware instrumentation module.\n if (serverConfigFile) {\n addMiddlewareImports();\n addStorageInstrumentation(nuxt);\n addDatabaseInstrumentation(nuxt.options.nitro);\n }\n\n // Add the sentry config file to the include array\n nuxt.hook('prepare:types', options => {\n const tsConfig = options.tsConfig as { include?: string[] };\n\n if (!tsConfig.include) {\n tsConfig.include = [];\n }\n\n // Add type references for useRuntimeConfig in root files for nuxt v4\n // Should be relative to `root/.nuxt`\n if (clientConfigFile) {\n const relativePath = path.relative(nuxt.options.buildDir, clientConfigFile);\n tsConfig.include.push(relativePath);\n }\n if (serverConfigFile) {\n const relativePath = path.relative(nuxt.options.buildDir, serverConfigFile);\n tsConfig.include.push(relativePath);\n }\n });\n\n nuxt.hooks.hook('nitro:init', nitro => {\n if (nuxt.options?._prepare) {\n return;\n }\n\n if (serverConfigFile) {\n addMiddlewareInstrumentation(nitro);\n }\n\n if (serverConfigFile?.includes('.server.config')) {\n consoleSandbox(() => {\n const serverDir = nitro.options.output.serverDir;\n\n // Netlify env: https://docs.netlify.com/configure-builds/environment-variables/#build-metadata\n if (serverDir.includes('.netlify') || !!process.env.NETLIFY) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Warning: The Sentry SDK detected a Netlify build. Server-side support for the Sentry Nuxt SDK on Netlify is currently unreliable due to technical limitations of serverless functions. Traces are not collected, and errors may occasionally not be reported. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',\n );\n }\n\n // Vercel env: https://vercel.com/docs/projects/environment-variables/system-environment-variables#VERCEL\n if (serverDir.includes('.vercel') || !!process.env.VERCEL) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Warning: The Sentry SDK detected a Vercel build. The Sentry Nuxt SDK currently does not support tracing on Vercel. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',\n );\n }\n });\n\n if (moduleOptions.autoInjectServerSentry !== 'experimental_dynamic-import') {\n addServerConfigToBuild(moduleOptions, nitro, serverConfigFile);\n\n if (moduleOptions.debug) {\n const serverDirResolver = createResolver(nitro.options.output.serverDir);\n const serverConfigPath = serverDirResolver.resolve('sentry.server.config.mjs');\n\n // For the default nitro node-preset build output this relative path would be: ./.output/server/sentry.server.config.mjs\n const serverConfigRelativePath = `.${path.sep}${path.relative(nitro.options.rootDir, serverConfigPath)}`;\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Using \\`${serverConfigFile}\\` for server-side Sentry configuration. To activate Sentry on the Nuxt server-side, this file must be preloaded when starting your application. Make sure to add this where you deploy and/or run your application. Read more here: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/.`,\n );\n\n if (nitro.options.dev) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] During development, preload Sentry with the NODE_OPTIONS environment variable: \\`NODE_OPTIONS='--import ${serverConfigRelativePath}' nuxt dev\\`. The file is generated in the build directory (usually '.nuxt'). If you delete the build directory, run \\`nuxt dev\\` to regenerate it.`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] When running your built application, preload Sentry via a command-line flag (\\`node --import ${serverConfigRelativePath} [...]\\`) or via an environment variable (\\`NODE_OPTIONS='--import ${serverConfigRelativePath}' node [...]\\`).`,\n );\n }\n });\n }\n }\n\n if (moduleOptions.autoInjectServerSentry === 'top-level-import') {\n addSentryTopImport(moduleOptions, nitro);\n }\n\n if (moduleOptions.autoInjectServerSentry === 'experimental_dynamic-import') {\n addDynamicImportEntryFileWrapper(nitro, serverConfigFile, moduleOptions);\n\n if (moduleOptions.debug) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Wrapping the server entry file with a dynamic `import()`, so Sentry can be preloaded before the server initializes.',\n );\n });\n }\n }\n }\n });\n },\n});\n"],"names":["defineNuxtModule","createResolver","findDefaultSdkInitFile","addPluginTemplate","addPlugin","addServerPlugin","setupSourceMaps","addOTelCommonJSImportAlias","addTemplate","addMiddlewareImports","addStorageInstrumentation","addDatabaseInstrumentation","addMiddlewareInstrumentation","consoleSandbox","addServerConfigToBuild","addSentryTopImport","addDynamicImportEntryFileWrapper"],"mappings":";;;;;;;;;;;AAoBA,iBAAeA,oBAAgB,CAAgB;AAC/C,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,qBAAqB;AAC/B,IAAI,SAAS,EAAE,QAAQ;AACvB,IAAI,aAAa,EAAE;AACnB,MAAM,IAAI,EAAE,SAAS;AACrB,KAAK;AACL,GAAG;AACH,EAAE,QAAQ,EAAE,EAAE;AACd,EAAE,KAAK,CAAC,kBAAkB,EAAE,IAAI,EAAE;AAClC,IAAI,IAAI,kBAAkB,EAAE,OAAA,KAAY,KAAK,EAAE;AAC/C,MAAM;AACN,IAAI;;AAEJ,IAAI,MAAM,gBAAgB;AAC1B,MAAM,GAAG,kBAAkB;AAC3B,MAAM,sBAAsB,EAAE,kBAAkB,CAAC,sBAAsB;AACvE,MAAM,uCAAuC,EAAE,kBAAkB,CAAC,2CAA2C;AAC7G,QAAQ,SAAS;AACjB,QAAQ,SAAS;AACjB,QAAQ,QAAQ;AAChB,OAAO;AACP,KAAK;;AAEL,IAAI,MAAM,iBAAA,GAAoBC,kBAAc,CAAC,2PAAe,CAAC;AAC7D,IAAI,MAAM,gBAAA,GAAmBA,kBAAc,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;;AAElE,IAAI,MAAM,mBAAmBC,4BAAsB,CAAC,QAAQ,EAAE,IAAI,CAAC;;AAEnE,IAAI,IAAI,gBAAgB,EAAE;AAC1B;AACA,MAAMC,qBAAiB,CAAC;AACxB,QAAQ,IAAI,EAAE,QAAQ;AACtB,QAAQ,QAAQ,EAAE,0BAA0B;AAC5C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EAAA,gBAAA,CAAA,CAAA,CAAA;;AAEA,YAAAY,mBAAA,CAAA,MAAA;AACA;AACA,cAAA,OAAA,CAAA,GAAA;AACA,gBAAA,CAAA,iBAAA,EAAA,gBAAA,CAAA,sSAAA,CAAA;AACA,eAAA;;AAEA,cAAA,IAAA,KAAA,CAAA,OAAA,CAAA,GAAA,EAAA;AACA;AACA,gBAAA,OAAA,CAAA,GAAA;AACA,kBAAA,CAAA,iHAAA,EAAA,wBAAA,CAAA,mJAAA,CAAA;AACA,iBAAA;AACA,cAAA,CAAA,MAAA;AACA;AACA,gBAAA,OAAA,CAAA,GAAA;AACA,kBAAA,CAAA,sGAAA,EAAA,wBAAA,CAAA,mEAAA,EAAA,wBAAA,CAAA,gBAAA,CAAA;AACA,iBAAA;AACA,cAAA;AACA,YAAA,CAAA,CAAA;AACA,UAAA;AACA,QAAA;;AAEA,QAAA,IAAA,aAAA,CAAA,sBAAA,KAAA,kBAAA,EAAA;AACA,UAAAE,kCAAA,CAAA,aAAA,EAAA,KAAA,CAAA;AACA,QAAA;;AAEA,QAAA,IAAA,aAAA,CAAA,sBAAA,KAAA,6BAAA,EAAA;AACA,UAAAC,gDAAA,CAAA,KAAA,EAAA,gBAAA,EAAA,aAAA,CAAA;;AAEA,UAAA,IAAA,aAAA,CAAA,KAAA,EAAA;AACA,YAAAH,mBAAA,CAAA,MAAA;AACA;AACA,cAAA,OAAA,CAAA,GAAA;AACA,gBAAA,8HAAA;AACA,eAAA;AACA,YAAA,CAAA,CAAA;AACA,UAAA;AACA,QAAA;AACA,MAAA;AACA,IAAA,CAAA,CAAA;AACA,EAAA,CAAA;AACA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"module.js","sources":["../../src/module.ts"],"sourcesContent":["import {\n addPlugin,\n addPluginTemplate,\n addServerPlugin,\n addTemplate,\n createResolver,\n defineNuxtModule,\n} from '@nuxt/kit';\nimport { consoleSandbox } from '@sentry/core';\nimport * as path from 'path';\nimport type { SentryNuxtModuleOptions } from './common/types';\nimport { addDynamicImportEntryFileWrapper, addSentryTopImport, addServerConfigToBuild } from './vite/addServerConfig';\nimport { addDatabaseInstrumentation } from './vite/databaseConfig';\nimport { addMiddlewareImports, addMiddlewareInstrumentation } from './vite/middlewareConfig';\nimport { setupSourceMaps } from './vite/sourceMaps';\nimport { addStorageInstrumentation } from './vite/storageConfig';\nimport { addOTelCommonJSImportAlias, findDefaultSdkInitFile } from './vite/utils';\n\nexport type ModuleOptions = SentryNuxtModuleOptions;\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@sentry/nuxt/module',\n configKey: 'sentry',\n compatibility: {\n nuxt: '>=3.7.0',\n },\n },\n defaults: {},\n setup(moduleOptionsParam, nuxt) {\n if (moduleOptionsParam?.enabled === false) {\n return;\n }\n\n const moduleOptions = {\n ...moduleOptionsParam,\n autoInjectServerSentry: moduleOptionsParam.autoInjectServerSentry,\n experimental_entrypointWrappedFunctions: moduleOptionsParam.experimental_entrypointWrappedFunctions || [\n 'default',\n 'handler',\n 'server',\n ],\n };\n\n const moduleDirResolver = createResolver(import.meta.url);\n const buildDirResolver = createResolver(nuxt.options.buildDir);\n\n const clientConfigFile = findDefaultSdkInitFile('client', nuxt);\n\n if (clientConfigFile) {\n // Inject the client-side Sentry config file with a side effect import\n addPluginTemplate({\n mode: 'client',\n filename: 'sentry-client-config.mjs',\n order: 0,\n\n // Dynamic import of config file to wrap it within a Nuxt context (here: defineNuxtPlugin)\n // Makes it possible to call useRuntimeConfig() in the user-defined sentry config file\n getContents: () => `\n import { defineNuxtPlugin } from \"#imports\";\n\n export default defineNuxtPlugin({\n name: 'sentry-client-config',\n async setup() {\n await import(\"${buildDirResolver.resolve(`/${clientConfigFile}`)}\")\n }\n });`,\n });\n\n // Add the plugin which loads client integrations etc. -\n // this must run after the sentry-client-config plugin has run, and the client is initialized!\n addPlugin({\n src: moduleDirResolver.resolve('./runtime/plugins/sentry.client'),\n mode: 'client',\n order: 1,\n });\n }\n\n const serverConfigFile = findDefaultSdkInitFile('server', nuxt);\n\n if (serverConfigFile) {\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/sentry.server'));\n\n addPlugin({\n src: moduleDirResolver.resolve('./runtime/plugins/route-detector.server'),\n mode: 'server',\n });\n }\n\n if (clientConfigFile || serverConfigFile) {\n setupSourceMaps(moduleOptions, nuxt);\n }\n\n addOTelCommonJSImportAlias(nuxt);\n\n const pagesDataTemplate = addTemplate({\n filename: 'sentry--nuxt-pages-data.mjs',\n // Initial empty array (later filled in pages:extend hook)\n // Template needs to be created in the root-level of the module to work\n getContents: () => 'export default [];',\n });\n\n nuxt.hooks.hook('pages:extend', pages => {\n pagesDataTemplate.getContents = () => {\n const pagesSubset = pages\n .map(page => ({ file: page.file, path: page.path }))\n .filter(page => {\n // Check for dynamic parameter (e.g., :userId or [userId])\n return page.path.includes(':') || page?.file?.includes('[');\n });\n\n return `export default ${JSON.stringify(pagesSubset, null, 2)};`;\n };\n });\n\n // Preps the the middleware instrumentation module.\n if (serverConfigFile) {\n addMiddlewareImports();\n addStorageInstrumentation(nuxt);\n addDatabaseInstrumentation(nuxt.options.nitro, moduleOptions);\n }\n\n // Add the sentry config file to the include array\n nuxt.hook('prepare:types', options => {\n const tsConfig = options.tsConfig as { include?: string[] };\n\n if (!tsConfig.include) {\n tsConfig.include = [];\n }\n\n // Add type references for useRuntimeConfig in root files for nuxt v4\n // Should be relative to `root/.nuxt`\n if (clientConfigFile) {\n const relativePath = path.relative(nuxt.options.buildDir, clientConfigFile);\n tsConfig.include.push(relativePath);\n }\n if (serverConfigFile) {\n const relativePath = path.relative(nuxt.options.buildDir, serverConfigFile);\n tsConfig.include.push(relativePath);\n }\n });\n\n nuxt.hooks.hook('nitro:init', nitro => {\n if (nuxt.options?._prepare) {\n return;\n }\n\n if (serverConfigFile) {\n addMiddlewareInstrumentation(nitro);\n }\n\n if (serverConfigFile?.includes('.server.config')) {\n consoleSandbox(() => {\n const serverDir = nitro.options.output.serverDir;\n\n // Netlify env: https://docs.netlify.com/configure-builds/environment-variables/#build-metadata\n if (serverDir.includes('.netlify') || !!process.env.NETLIFY) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Warning: The Sentry SDK detected a Netlify build. Server-side support for the Sentry Nuxt SDK on Netlify is currently unreliable due to technical limitations of serverless functions. Traces are not collected, and errors may occasionally not be reported. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',\n );\n }\n\n // Vercel env: https://vercel.com/docs/projects/environment-variables/system-environment-variables#VERCEL\n if (serverDir.includes('.vercel') || !!process.env.VERCEL) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Warning: The Sentry SDK detected a Vercel build. The Sentry Nuxt SDK currently does not support tracing on Vercel. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',\n );\n }\n });\n\n if (moduleOptions.autoInjectServerSentry !== 'experimental_dynamic-import') {\n addServerConfigToBuild(moduleOptions, nitro, serverConfigFile);\n\n if (moduleOptions.debug) {\n const serverDirResolver = createResolver(nitro.options.output.serverDir);\n const serverConfigPath = serverDirResolver.resolve('sentry.server.config.mjs');\n\n // For the default nitro node-preset build output this relative path would be: ./.output/server/sentry.server.config.mjs\n const serverConfigRelativePath = `.${path.sep}${path.relative(nitro.options.rootDir, serverConfigPath)}`;\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Using \\`${serverConfigFile}\\` for server-side Sentry configuration. To activate Sentry on the Nuxt server-side, this file must be preloaded when starting your application. Make sure to add this where you deploy and/or run your application. Read more here: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/.`,\n );\n\n if (nitro.options.dev) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] During development, preload Sentry with the NODE_OPTIONS environment variable: \\`NODE_OPTIONS='--import ${serverConfigRelativePath}' nuxt dev\\`. The file is generated in the build directory (usually '.nuxt'). If you delete the build directory, run \\`nuxt dev\\` to regenerate it.`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] When running your built application, preload Sentry via a command-line flag (\\`node --import ${serverConfigRelativePath} [...]\\`) or via an environment variable (\\`NODE_OPTIONS='--import ${serverConfigRelativePath}' node [...]\\`).`,\n );\n }\n });\n }\n }\n\n if (moduleOptions.autoInjectServerSentry === 'top-level-import') {\n addSentryTopImport(moduleOptions, nitro);\n }\n\n if (moduleOptions.autoInjectServerSentry === 'experimental_dynamic-import') {\n addDynamicImportEntryFileWrapper(nitro, serverConfigFile, moduleOptions);\n\n if (moduleOptions.debug) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Wrapping the server entry file with a dynamic `import()`, so Sentry can be preloaded before the server initializes.',\n );\n });\n }\n }\n }\n });\n },\n});\n"],"names":["defineNuxtModule","createResolver","findDefaultSdkInitFile","addPluginTemplate","addPlugin","addServerPlugin","setupSourceMaps","addOTelCommonJSImportAlias","addTemplate","addMiddlewareImports","addStorageInstrumentation","addDatabaseInstrumentation","addMiddlewareInstrumentation","consoleSandbox","addServerConfigToBuild","addSentryTopImport","addDynamicImportEntryFileWrapper"],"mappings":";;;;;;;;;;;AAoBA,iBAAeA,oBAAgB,CAAgB;AAC/C,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,qBAAqB;AAC/B,IAAI,SAAS,EAAE,QAAQ;AACvB,IAAI,aAAa,EAAE;AACnB,MAAM,IAAI,EAAE,SAAS;AACrB,KAAK;AACL,GAAG;AACH,EAAE,QAAQ,EAAE,EAAE;AACd,EAAE,KAAK,CAAC,kBAAkB,EAAE,IAAI,EAAE;AAClC,IAAI,IAAI,kBAAkB,EAAE,OAAA,KAAY,KAAK,EAAE;AAC/C,MAAM;AACN,IAAI;;AAEJ,IAAI,MAAM,gBAAgB;AAC1B,MAAM,GAAG,kBAAkB;AAC3B,MAAM,sBAAsB,EAAE,kBAAkB,CAAC,sBAAsB;AACvE,MAAM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A,EAAA,gBAAA,EAAA,aAAA,CAAA;;AAEA,UAAA,IAAA,aAAA,CAAA,KAAA,EAAA;AACA,YAAAH,mBAAA,CAAA,MAAA;AACA;AACA,cAAA,OAAA,CAAA,GAAA;AACA,gBAAA,8HAAA;AACA,eAAA;AACA,YAAA,CAAA,CAAA;AACA,UAAA;AACA,QAAA;AACA,MAAA;AACA,IAAA,CAAA,CAAA;AACA,EAAA,CAAA;AACA,CAAA,CAAA;;;;"}
@@ -12,8 +12,9 @@ const debugBuild = require('../common/debug-build.js');
12
12
  * @param options Configuration options for the SDK.
13
13
  */
14
14
  function init(options) {
15
+ const envFallback = !nodeCore.isCjs() && undefined ? core.DEV_ENVIRONMENT : core.DEFAULT_ENVIRONMENT;
15
16
  const sentryOptions = {
16
- environment: !nodeCore.isCjs() && undefined ? core.DEV_ENVIRONMENT : core.DEFAULT_ENVIRONMENT,
17
+ environment: options.environment ?? process.env.SENTRY_ENVIRONMENT ?? envFallback,
17
18
  defaultIntegrations: getNuxtDefaultIntegrations(options),
18
19
  ...options,
19
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sources":["../../../src/server/sdk.ts"],"sourcesContent":["import * as path from 'node:path';\nimport type { Client, Event, EventProcessor, Integration } from '@sentry/core';\nimport {\n applySdkMetadata,\n debug,\n DEFAULT_ENVIRONMENT,\n DEV_ENVIRONMENT,\n flush,\n getGlobalScope,\n vercelWaitUntil,\n} from '@sentry/core';\nimport {\n getDefaultIntegrations as getDefaultNodeIntegrations,\n httpIntegration,\n init as initNode,\n type NodeOptions,\n} from '@sentry/node';\nimport { isCjs } from '@sentry/node-core';\nimport { DEBUG_BUILD } from '../common/debug-build';\nimport type { SentryNuxtServerOptions } from '../common/types';\n\n/**\n * Initializes the server-side of the Nuxt SDK\n *\n * @param options Configuration options for the SDK.\n */\nexport function init(options: SentryNuxtServerOptions): Client | undefined {\n const sentryOptions = {\n environment: !isCjs() && import.meta.dev ? DEV_ENVIRONMENT : DEFAULT_ENVIRONMENT,\n defaultIntegrations: getNuxtDefaultIntegrations(options),\n ...options,\n };\n\n applySdkMetadata(sentryOptions, 'nuxt', ['nuxt', 'node']);\n\n const client = initNode(sentryOptions);\n\n getGlobalScope().addEventProcessor(lowQualityTransactionsFilter(options));\n getGlobalScope().addEventProcessor(clientSourceMapErrorFilter(options));\n\n return client;\n}\n\n/**\n * Filter out transactions for resource requests which we don't want to send to Sentry\n * for quota reasons.\n *\n * Only exported for testing\n */\nexport function lowQualityTransactionsFilter(options: SentryNuxtServerOptions): EventProcessor {\n return Object.assign(\n (event => {\n if (event.type !== 'transaction' || !event.transaction || isCacheEvent(event)) {\n return event;\n }\n\n // Check if this looks like a parametrized route (contains :param or :param() patterns)\n const hasRouteParameters = /\\/:[^(/\\s]*(\\([^)]*\\))?[^/\\s]*/.test(event.transaction);\n\n if (hasRouteParameters) {\n return event;\n }\n\n // We don't want to send transaction for file requests, so everything ending with a *.someExtension should be filtered out\n // path.extname will return an empty string for normal page requests\n if (path.extname(event.transaction)) {\n options.debug &&\n DEBUG_BUILD &&\n debug.log('NuxtLowQualityTransactionsFilter filtered transaction: ', event.transaction);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'NuxtLowQualityTransactionsFilter' },\n );\n}\n\n/**\n * The browser devtools try to get the source maps, but as client source maps may not be available there is going to be an error (no problem for the application though).\n *\n * Only exported for testing\n */\nexport function clientSourceMapErrorFilter(options: SentryNuxtServerOptions): EventProcessor {\n return Object.assign(\n (event => {\n const errorMsg = event.exception?.values?.[0]?.value;\n if (errorMsg?.match(/^ENOENT: no such file or directory, open '.*\\/_nuxt\\/.*\\.js\\.map'/)) {\n options.debug && DEBUG_BUILD && debug.log('NuxtClientSourceMapErrorFilter filtered error: ', errorMsg);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'NuxtClientSourceMapErrorFilter' },\n );\n}\n\nfunction getNuxtDefaultIntegrations(options: NodeOptions): Integration[] {\n return [\n ...getDefaultNodeIntegrations(options).filter(integration => integration.name !== 'Http'),\n // The httpIntegration is added as defaultIntegration, so users can still overwrite it\n httpIntegration({\n instrumentation: {\n responseHook: () => {\n // Makes it possible to end the tracing span before closing the Vercel lambda (https://vercel.com/docs/functions/functions-api-reference#waituntil)\n vercelWaitUntil(flushSafelyWithTimeout());\n },\n },\n }),\n ];\n}\n\n/**\n * Flushes pending Sentry events with a 2-second timeout and in a way that cannot create unhandled promise rejections.\n */\nasync function flushSafelyWithTimeout(): Promise<void> {\n try {\n DEBUG_BUILD && debug.log('Flushing events...');\n await flush(2000);\n DEBUG_BUILD && debug.log('Done flushing events');\n } catch (e) {\n DEBUG_BUILD && debug.log('Error while flushing events:\\n', e);\n }\n}\n\n/**\n * Checks if the event is a cache event.\n */\nfunction isCacheEvent(e: Event): boolean {\n return e.contexts?.trace?.origin === 'auto.cache.nuxt';\n}\n"],"names":["isCjs","DEV_ENVIRONMENT","DEFAULT_ENVIRONMENT","applySdkMetadata","initNode","getGlobalScope","DEBUG_BUILD","debug","getDefaultNodeIntegrations","httpIntegration","vercelWaitUntil","flush"],"mappings":";;;;;;;;AAqBA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAA+C;AAC3E,EAAE,MAAM,gBAAgB;AACxB,IAAI,WAAW,EAAE,CAACA,cAAK,EAAC,IAAK,SAAY,GAAMC,oBAAA,GAAkBC,wBAAmB;AACpF,IAAI,mBAAmB,EAAE,0BAA0B,CAAC,OAAO,CAAC;AAC5D,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAEC,qBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;AAE3D,EAAE,MAAM,MAAA,GAASC,SAAQ,CAAC,aAAa,CAAC;;AAExC,EAAEC,mBAAc,EAAE,CAAC,iBAAiB,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC;AAC3E,EAAEA,mBAAc,EAAE,CAAC,iBAAiB,CAAC,0BAA0B,CAA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,OAAO,IAAI;AACnB,MAAM;AACN,MAAM,OAAO,KAAK;AAClB,IAAI,CAAC;AACL,IAAI,EAAE,EAAE,EAAE,gCAAA,EAAkC;AAC5C,GAAG;AACH;;AAEA,SAAS,0BAA0B,CAAC,OAAO,EAA8B;AACzE,EAAE,OAAO;AACT,IAAI,GAAGC,2BAA0B,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,WAAA,IAAe,WAAW,CAAC,IAAA,KAAS,MAAM,CAAC;AAC7F;AACA,IAAIC,oBAAe,CAAC;AACpB,MAAM,eAAe,EAAE;AACvB,QAAQ,YAAY,EAAE,MAAM;AAC5B;AACA,UAAUC,oBAAe,CAAC,sBAAsB,EAAE,CAAC;AACnD,QAAQ,CAAC;AACT,OAAO;AACP,KAAK,CAAC;AACN,GAAG;AACH;;AAEA;AACA;AACA;AACA,eAAe,sBAAsB,GAAkB;AACvD,EAAE,IAAI;AACN,IAAIJ,0BAAeC,UAAK,CAAC,GAAG,CAAC,oBAAoB,CAAC;AAClD,IAAI,MAAMI,UAAK,CAAC,IAAI,CAAC;AACrB,IAAIL,0BAAeC,UAAK,CAAC,GAAG,CAAC,sBAAsB,CAAC;AACpD,EAAE,CAAA,CAAE,OAAO,CAAC,EAAE;AACd,IAAID,sBAAA,IAAeC,UAAK,CAAC,GAAG,CAAC,gCAAgC,EAAE,CAAC,CAAC;AACjE,EAAE;AACF;;AAEA;AACA;AACA;AACA,SAAS,YAAY,CAAC,CAAC,EAAkB;AACzC,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAA,KAAW,iBAAiB;AACxD;;;;;;"}
1
+ {"version":3,"file":"sdk.js","sources":["../../../src/server/sdk.ts"],"sourcesContent":["import * as path from 'node:path';\nimport type { Client, Event, EventProcessor, Integration } from '@sentry/core';\nimport {\n applySdkMetadata,\n debug,\n DEFAULT_ENVIRONMENT,\n DEV_ENVIRONMENT,\n flush,\n getGlobalScope,\n vercelWaitUntil,\n} from '@sentry/core';\nimport {\n getDefaultIntegrations as getDefaultNodeIntegrations,\n httpIntegration,\n init as initNode,\n type NodeOptions,\n} from '@sentry/node';\nimport { isCjs } from '@sentry/node-core';\nimport { DEBUG_BUILD } from '../common/debug-build';\nimport type { SentryNuxtServerOptions } from '../common/types';\n\n/**\n * Initializes the server-side of the Nuxt SDK\n *\n * @param options Configuration options for the SDK.\n */\nexport function init(options: SentryNuxtServerOptions): Client | undefined {\n const envFallback = !isCjs() && import.meta.dev ? DEV_ENVIRONMENT : DEFAULT_ENVIRONMENT;\n const sentryOptions = {\n environment: options.environment ?? process.env.SENTRY_ENVIRONMENT ?? envFallback,\n defaultIntegrations: getNuxtDefaultIntegrations(options),\n ...options,\n };\n\n applySdkMetadata(sentryOptions, 'nuxt', ['nuxt', 'node']);\n\n const client = initNode(sentryOptions);\n\n getGlobalScope().addEventProcessor(lowQualityTransactionsFilter(options));\n getGlobalScope().addEventProcessor(clientSourceMapErrorFilter(options));\n\n return client;\n}\n\n/**\n * Filter out transactions for resource requests which we don't want to send to Sentry\n * for quota reasons.\n *\n * Only exported for testing\n */\nexport function lowQualityTransactionsFilter(options: SentryNuxtServerOptions): EventProcessor {\n return Object.assign(\n (event => {\n if (event.type !== 'transaction' || !event.transaction || isCacheEvent(event)) {\n return event;\n }\n\n // Check if this looks like a parametrized route (contains :param or :param() patterns)\n const hasRouteParameters = /\\/:[^(/\\s]*(\\([^)]*\\))?[^/\\s]*/.test(event.transaction);\n\n if (hasRouteParameters) {\n return event;\n }\n\n // We don't want to send transaction for file requests, so everything ending with a *.someExtension should be filtered out\n // path.extname will return an empty string for normal page requests\n if (path.extname(event.transaction)) {\n options.debug &&\n DEBUG_BUILD &&\n debug.log('NuxtLowQualityTransactionsFilter filtered transaction: ', event.transaction);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'NuxtLowQualityTransactionsFilter' },\n );\n}\n\n/**\n * The browser devtools try to get the source maps, but as client source maps may not be available there is going to be an error (no problem for the application though).\n *\n * Only exported for testing\n */\nexport function clientSourceMapErrorFilter(options: SentryNuxtServerOptions): EventProcessor {\n return Object.assign(\n (event => {\n const errorMsg = event.exception?.values?.[0]?.value;\n if (errorMsg?.match(/^ENOENT: no such file or directory, open '.*\\/_nuxt\\/.*\\.js\\.map'/)) {\n options.debug && DEBUG_BUILD && debug.log('NuxtClientSourceMapErrorFilter filtered error: ', errorMsg);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'NuxtClientSourceMapErrorFilter' },\n );\n}\n\nfunction getNuxtDefaultIntegrations(options: NodeOptions): Integration[] {\n return [\n ...getDefaultNodeIntegrations(options).filter(integration => integration.name !== 'Http'),\n // The httpIntegration is added as defaultIntegration, so users can still overwrite it\n httpIntegration({\n instrumentation: {\n responseHook: () => {\n // Makes it possible to end the tracing span before closing the Vercel lambda (https://vercel.com/docs/functions/functions-api-reference#waituntil)\n vercelWaitUntil(flushSafelyWithTimeout());\n },\n },\n }),\n ];\n}\n\n/**\n * Flushes pending Sentry events with a 2-second timeout and in a way that cannot create unhandled promise rejections.\n */\nasync function flushSafelyWithTimeout(): Promise<void> {\n try {\n DEBUG_BUILD && debug.log('Flushing events...');\n await flush(2000);\n DEBUG_BUILD && debug.log('Done flushing events');\n } catch (e) {\n DEBUG_BUILD && debug.log('Error while flushing events:\\n', e);\n }\n}\n\n/**\n * Checks if the event is a cache event.\n */\nfunction isCacheEvent(e: Event): boolean {\n return e.contexts?.trace?.origin === 'auto.cache.nuxt';\n}\n"],"names":["isCjs","DEV_ENVIRONMENT","DEFAULT_ENVIRONMENT","applySdkMetadata","initNode","getGlobalScope","DEBUG_BUILD","debug","getDefaultNodeIntegrations","httpIntegration","vercelWaitUntil","flush"],"mappings":";;;;;;;;AAqBA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAA+C;AAC3E,EAAE,MAAM,WAAA,GAAc,CAACA,cAAK,EAAC,IAAK,SAAY,GAAMC,oBAAA,GAAkBC,wBAAmB;AACzF,EAAE,MA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AAO,CAAC,EAAE;AACd,IAAID,sBAAA,IAAeC,UAAK,CAAC,GAAG,CAAC,gCAAgC,EAAE,CAAC,CAAC;AACjE,EAAE;AACF;;AAEA;AACA;AACA;AACA,SAAS,YAAY,CAAC,CAAC,EAAkB;AACzC,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAA,KAAW,iBAAiB;AACxD;;;;;;"}
@@ -8,14 +8,17 @@ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentS
8
8
  /**
9
9
  * Sets up the database instrumentation.
10
10
  */
11
- function addDatabaseInstrumentation(nitro) {
11
+ function addDatabaseInstrumentation(nitro, moduleOptions) {
12
12
  if (!nitro.experimental?.database) {
13
- core.consoleSandbox(() => {
14
- // eslint-disable-next-line no-console
15
- console.log(
16
- '[Sentry] [Nitro Database Plugin]: No database configuration found. Skipping database instrumentation.',
17
- );
18
- });
13
+ // We cannot use DEBUG_BUILD here because it is a runtime flag, so it is not available for build time scripts
14
+ // So we have to pass in the module options to the build time script
15
+ moduleOptions?.debug &&
16
+ core.consoleSandbox(() => {
17
+ // eslint-disable-next-line no-console
18
+ console.log(
19
+ '[Sentry] [Nitro Database Plugin]: No database configuration found. Skipping database instrumentation.',
20
+ );
21
+ });
19
22
 
20
23
  return;
21
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"databaseConfig.js","sources":["../../../src/vite/databaseConfig.ts"],"sourcesContent":["import { addServerPlugin, createResolver } from '@nuxt/kit';\nimport { consoleSandbox } from '@sentry/core';\nimport type { NitroConfig } from 'nitropack/types';\nimport { addServerTemplate } from '../vendor/server-template';\n\n/**\n * Sets up the database instrumentation.\n */\nexport function addDatabaseInstrumentation(nitro: NitroConfig): void {\n if (!nitro.experimental?.database) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] [Nitro Database Plugin]: No database configuration found. Skipping database instrumentation.',\n );\n });\n\n return;\n }\n\n /**\n * This is a different option than the one in `experimental.database`, this configures multiple database instances.\n * keys represent database names to be passed to `useDatabase(name?)`.\n * We also use the config to populate database span attributes.\n * https://nitro.build/guide/database#configuration\n */\n const databaseConfig = nitro.database || { default: {} };\n\n // Create a virtual module to pass this data to runtime\n addServerTemplate({\n filename: '#sentry/database-config.mjs',\n getContents: () => {\n return `export const databaseConfig = ${JSON.stringify(databaseConfig)};`;\n },\n });\n\n addServerPlugin(createResolver(import.meta.url).resolve('./runtime/plugins/database.server'));\n}\n"],"names":["consoleSandbox","addServerTemplate","addServerPlugin","createResolver"],"mappings":";;;;;;;AAKA;AACA;AACA;AACO,SAAS,0BAA0B,CAAC,KAAK,EAAqB;AACrE,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,QAAQ,EAAE;AACrC,IAAIA,mBAAc,CAAC,MAAM;AACzB;AACA,MAAM,OAAO,CAAC,GAAG;AACjB,QAAQ,uGAAuG;AAC/G,OAAO;AACP,IAAI,CAAC,CAAC;;AAEN,IAAI;AACJ,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,MAAM,cAAA,GAAiB,KAAK,CAAC,QAAA,IAAY,EAAE,OAAO,EAAE,EAAC,EAAG;;AAE1D;AACA,EAAEC,gCAAiB,CAAC;AACpB,IAAI,QAAQ,EAAE,6BAA6B;AAC3C,IAAI,WAAW,EAAE,MAAM;AACvB,MAAM,OAAO,CAAC,8BAA8B,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAC/E,IAAI,CAAC;AACL,GAAG,CAAC;;AAEJ,EAAEC,mBAAe,CAACC,kBAAc,CAAC,wQAAe,CAAC,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC/F;;;;"}
1
+ {"version":3,"file":"databaseConfig.js","sources":["../../../src/vite/databaseConfig.ts"],"sourcesContent":["import { addServerPlugin, createResolver } from '@nuxt/kit';\nimport { consoleSandbox } from '@sentry/core';\nimport type { NitroConfig } from 'nitropack/types';\nimport type { SentryNuxtModuleOptions } from '../common/types';\nimport { addServerTemplate } from '../vendor/server-template';\n\n/**\n * Sets up the database instrumentation.\n */\nexport function addDatabaseInstrumentation(nitro: NitroConfig, moduleOptions?: SentryNuxtModuleOptions): void {\n if (!nitro.experimental?.database) {\n // We cannot use DEBUG_BUILD here because it is a runtime flag, so it is not available for build time scripts\n // So we have to pass in the module options to the build time script\n moduleOptions?.debug &&\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] [Nitro Database Plugin]: No database configuration found. Skipping database instrumentation.',\n );\n });\n\n return;\n }\n\n /**\n * This is a different option than the one in `experimental.database`, this configures multiple database instances.\n * keys represent database names to be passed to `useDatabase(name?)`.\n * We also use the config to populate database span attributes.\n * https://nitro.build/guide/database#configuration\n */\n const databaseConfig = nitro.database || { default: {} };\n\n // Create a virtual module to pass this data to runtime\n addServerTemplate({\n filename: '#sentry/database-config.mjs',\n getContents: () => {\n return `export const databaseConfig = ${JSON.stringify(databaseConfig)};`;\n },\n });\n\n addServerPlugin(createResolver(import.meta.url).resolve('./runtime/plugins/database.server'));\n}\n"],"names":["consoleSandbox","addServerTemplate","addServerPlugin","createResolver"],"mappings":";;;;;;;AAMA;AACA;AACA;AACO,SAAS,0BAA0B,CAAC,KAAK,EAAe,aAAa,EAAkC;AAC9G,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,QAAQ,EAAE;AACrC;AACA;AACA,IAAI,aAAa,EAAE,KAAA;AACnB,MAAMA,mBAAc,CAAC,MAAM;AAC3B;AACA,QAAQ,OAAO,CAAC,GAAG;AACnB,UAAU,uGAAuG;AACjH,SAAS;AACT,MAAM,CAAC,CAAC;;AAER,IAAI;AACJ,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,MAAM,cAAA,GAAiB,KAAK,CAAC,QAAA,IAAY,EAAE,OAAO,EAAE,EAAC,EAAG;;AAE1D;AACA,EAAEC,gCAAiB,CAAC;AACpB,IAAI,QAAQ,EAAE,6BAA6B;AAC3C,IAAI,WAAW,EAAE,MAAM;AACvB,MAAM,OAAO,CAAC,8BAA8B,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAC/E,IAAI,CAAC;AACL,GAAG,CAAC;;AAEJ,EAAEC,mBAAe,CAACC,kBAAc,CAAC,wQAAe,CAAC,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC/F;;;;"}
@@ -7,10 +7,11 @@ import { applySdkMetadata, DEV_ENVIRONMENT, DEFAULT_ENVIRONMENT } from '@sentry/
7
7
  * @param options Configuration options for the SDK.
8
8
  */
9
9
  function init(options) {
10
+ const envFallback = import.meta.dev ? DEV_ENVIRONMENT : DEFAULT_ENVIRONMENT;
10
11
  const sentryOptions = {
11
12
  /* BrowserTracing is added later with the Nuxt client plugin */
12
13
  defaultIntegrations: [...getDefaultIntegrations(options)],
13
- environment: import.meta.dev ? DEV_ENVIRONMENT : DEFAULT_ENVIRONMENT,
14
+ environment: options.environment ?? process.env.SENTRY_ENVIRONMENT ?? envFallback,
14
15
  ...options,
15
16
  };
16
17
 
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sources":["../../../src/client/sdk.ts"],"sourcesContent":["import { getDefaultIntegrations as getBrowserDefaultIntegrations, init as initBrowser } from '@sentry/browser';\nimport type { Client } from '@sentry/core';\nimport { applySdkMetadata, DEFAULT_ENVIRONMENT, DEV_ENVIRONMENT } from '@sentry/core';\nimport type { SentryNuxtClientOptions } from '../common/types';\n\n/**\n * Initializes the client-side of the Nuxt SDK\n *\n * @param options Configuration options for the SDK.\n */\nexport function init(options: SentryNuxtClientOptions): Client | undefined {\n const sentryOptions = {\n /* BrowserTracing is added later with the Nuxt client plugin */\n defaultIntegrations: [...getBrowserDefaultIntegrations(options)],\n environment: import.meta.dev ? DEV_ENVIRONMENT : DEFAULT_ENVIRONMENT,\n ...options,\n };\n\n applySdkMetadata(sentryOptions, 'nuxt', ['nuxt', 'vue']);\n\n return initBrowser(sentryOptions);\n}\n"],"names":["getBrowserDefaultIntegrations","initBrowser"],"mappings":";;;AAKA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAA+C;AAC3E,EAAE,MAAM,gBAAgB;AACxB;AACA,IAAI,mBAAmB,EAAE,CAAC,GAAGA,sBAA6B,CAAC,OAAO,CAAC,CAAC;AACpE,IAAI,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,GAAA,GAAM,eAAA,GAAkB,mBAAmB;AACxE,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAE,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;;AAE1D,EAAE,OAAOC,MAAW,CAAC,aAAa,CAAC;AACnC;;;;"}
1
+ {"version":3,"file":"sdk.js","sources":["../../../src/client/sdk.ts"],"sourcesContent":["import { getDefaultIntegrations as getBrowserDefaultIntegrations, init as initBrowser } from '@sentry/browser';\nimport type { Client } from '@sentry/core';\nimport { applySdkMetadata, DEFAULT_ENVIRONMENT, DEV_ENVIRONMENT } from '@sentry/core';\nimport type { SentryNuxtClientOptions } from '../common/types';\n\n/**\n * Initializes the client-side of the Nuxt SDK\n *\n * @param options Configuration options for the SDK.\n */\nexport function init(options: SentryNuxtClientOptions): Client | undefined {\n const envFallback = import.meta.dev ? DEV_ENVIRONMENT : DEFAULT_ENVIRONMENT;\n const sentryOptions = {\n /* BrowserTracing is added later with the Nuxt client plugin */\n defaultIntegrations: [...getBrowserDefaultIntegrations(options)],\n environment: options.environment ?? process.env.SENTRY_ENVIRONMENT ?? envFallback,\n ...options,\n };\n\n applySdkMetadata(sentryOptions, 'nuxt', ['nuxt', 'vue']);\n\n return initBrowser(sentryOptions);\n}\n"],"names":["getBrowserDefaultIntegrations","initBrowser"],"mappings":";;;AAKA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAA+C;AAC3E,EAAE,MAAM,WAAA,GAAc,MAAM,CAAC,IAAI,CAAC,GAAA,GAAM,eAAA,GAAkB,mBAAmB;AAC7E,EAAE,MAAM,gBAAgB;AACxB;AACA,IAAI,mBAAmB,EAAE,CAAC,GAAGA,sBAA6B,CAAC,OAAO,CAAC,CAAC;AACpE,IAAI,WAAW,EAAE,OAAO,CAAC,WAAA,IAAe,OAAO,CAAC,GAAG,CAAC,kBAAA,IAAsB,WAAW;AACrF,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAE,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;;AAE1D,EAAE,OAAOC,MAAW,CAAC,aAAa,CAAC;AACnC;;;;"}
@@ -107,7 +107,7 @@ const module$1 = defineNuxtModule({
107
107
  if (serverConfigFile) {
108
108
  addMiddlewareImports();
109
109
  addStorageInstrumentation(nuxt);
110
- addDatabaseInstrumentation(nuxt.options.nitro);
110
+ addDatabaseInstrumentation(nuxt.options.nitro, moduleOptions);
111
111
  }
112
112
 
113
113
  // Add the sentry config file to the include array
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sources":["../../src/module.ts"],"sourcesContent":["import {\n addPlugin,\n addPluginTemplate,\n addServerPlugin,\n addTemplate,\n createResolver,\n defineNuxtModule,\n} from '@nuxt/kit';\nimport { consoleSandbox } from '@sentry/core';\nimport * as path from 'path';\nimport type { SentryNuxtModuleOptions } from './common/types';\nimport { addDynamicImportEntryFileWrapper, addSentryTopImport, addServerConfigToBuild } from './vite/addServerConfig';\nimport { addDatabaseInstrumentation } from './vite/databaseConfig';\nimport { addMiddlewareImports, addMiddlewareInstrumentation } from './vite/middlewareConfig';\nimport { setupSourceMaps } from './vite/sourceMaps';\nimport { addStorageInstrumentation } from './vite/storageConfig';\nimport { addOTelCommonJSImportAlias, findDefaultSdkInitFile } from './vite/utils';\n\nexport type ModuleOptions = SentryNuxtModuleOptions;\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@sentry/nuxt/module',\n configKey: 'sentry',\n compatibility: {\n nuxt: '>=3.7.0',\n },\n },\n defaults: {},\n setup(moduleOptionsParam, nuxt) {\n if (moduleOptionsParam?.enabled === false) {\n return;\n }\n\n const moduleOptions = {\n ...moduleOptionsParam,\n autoInjectServerSentry: moduleOptionsParam.autoInjectServerSentry,\n experimental_entrypointWrappedFunctions: moduleOptionsParam.experimental_entrypointWrappedFunctions || [\n 'default',\n 'handler',\n 'server',\n ],\n };\n\n const moduleDirResolver = createResolver(import.meta.url);\n const buildDirResolver = createResolver(nuxt.options.buildDir);\n\n const clientConfigFile = findDefaultSdkInitFile('client', nuxt);\n\n if (clientConfigFile) {\n // Inject the client-side Sentry config file with a side effect import\n addPluginTemplate({\n mode: 'client',\n filename: 'sentry-client-config.mjs',\n order: 0,\n\n // Dynamic import of config file to wrap it within a Nuxt context (here: defineNuxtPlugin)\n // Makes it possible to call useRuntimeConfig() in the user-defined sentry config file\n getContents: () => `\n import { defineNuxtPlugin } from \"#imports\";\n\n export default defineNuxtPlugin({\n name: 'sentry-client-config',\n async setup() {\n await import(\"${buildDirResolver.resolve(`/${clientConfigFile}`)}\")\n }\n });`,\n });\n\n // Add the plugin which loads client integrations etc. -\n // this must run after the sentry-client-config plugin has run, and the client is initialized!\n addPlugin({\n src: moduleDirResolver.resolve('./runtime/plugins/sentry.client'),\n mode: 'client',\n order: 1,\n });\n }\n\n const serverConfigFile = findDefaultSdkInitFile('server', nuxt);\n\n if (serverConfigFile) {\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/sentry.server'));\n\n addPlugin({\n src: moduleDirResolver.resolve('./runtime/plugins/route-detector.server'),\n mode: 'server',\n });\n }\n\n if (clientConfigFile || serverConfigFile) {\n setupSourceMaps(moduleOptions, nuxt);\n }\n\n addOTelCommonJSImportAlias(nuxt);\n\n const pagesDataTemplate = addTemplate({\n filename: 'sentry--nuxt-pages-data.mjs',\n // Initial empty array (later filled in pages:extend hook)\n // Template needs to be created in the root-level of the module to work\n getContents: () => 'export default [];',\n });\n\n nuxt.hooks.hook('pages:extend', pages => {\n pagesDataTemplate.getContents = () => {\n const pagesSubset = pages\n .map(page => ({ file: page.file, path: page.path }))\n .filter(page => {\n // Check for dynamic parameter (e.g., :userId or [userId])\n return page.path.includes(':') || page?.file?.includes('[');\n });\n\n return `export default ${JSON.stringify(pagesSubset, null, 2)};`;\n };\n });\n\n // Preps the the middleware instrumentation module.\n if (serverConfigFile) {\n addMiddlewareImports();\n addStorageInstrumentation(nuxt);\n addDatabaseInstrumentation(nuxt.options.nitro);\n }\n\n // Add the sentry config file to the include array\n nuxt.hook('prepare:types', options => {\n const tsConfig = options.tsConfig as { include?: string[] };\n\n if (!tsConfig.include) {\n tsConfig.include = [];\n }\n\n // Add type references for useRuntimeConfig in root files for nuxt v4\n // Should be relative to `root/.nuxt`\n if (clientConfigFile) {\n const relativePath = path.relative(nuxt.options.buildDir, clientConfigFile);\n tsConfig.include.push(relativePath);\n }\n if (serverConfigFile) {\n const relativePath = path.relative(nuxt.options.buildDir, serverConfigFile);\n tsConfig.include.push(relativePath);\n }\n });\n\n nuxt.hooks.hook('nitro:init', nitro => {\n if (nuxt.options?._prepare) {\n return;\n }\n\n if (serverConfigFile) {\n addMiddlewareInstrumentation(nitro);\n }\n\n if (serverConfigFile?.includes('.server.config')) {\n consoleSandbox(() => {\n const serverDir = nitro.options.output.serverDir;\n\n // Netlify env: https://docs.netlify.com/configure-builds/environment-variables/#build-metadata\n if (serverDir.includes('.netlify') || !!process.env.NETLIFY) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Warning: The Sentry SDK detected a Netlify build. Server-side support for the Sentry Nuxt SDK on Netlify is currently unreliable due to technical limitations of serverless functions. Traces are not collected, and errors may occasionally not be reported. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',\n );\n }\n\n // Vercel env: https://vercel.com/docs/projects/environment-variables/system-environment-variables#VERCEL\n if (serverDir.includes('.vercel') || !!process.env.VERCEL) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Warning: The Sentry SDK detected a Vercel build. The Sentry Nuxt SDK currently does not support tracing on Vercel. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',\n );\n }\n });\n\n if (moduleOptions.autoInjectServerSentry !== 'experimental_dynamic-import') {\n addServerConfigToBuild(moduleOptions, nitro, serverConfigFile);\n\n if (moduleOptions.debug) {\n const serverDirResolver = createResolver(nitro.options.output.serverDir);\n const serverConfigPath = serverDirResolver.resolve('sentry.server.config.mjs');\n\n // For the default nitro node-preset build output this relative path would be: ./.output/server/sentry.server.config.mjs\n const serverConfigRelativePath = `.${path.sep}${path.relative(nitro.options.rootDir, serverConfigPath)}`;\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Using \\`${serverConfigFile}\\` for server-side Sentry configuration. To activate Sentry on the Nuxt server-side, this file must be preloaded when starting your application. Make sure to add this where you deploy and/or run your application. Read more here: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/.`,\n );\n\n if (nitro.options.dev) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] During development, preload Sentry with the NODE_OPTIONS environment variable: \\`NODE_OPTIONS='--import ${serverConfigRelativePath}' nuxt dev\\`. The file is generated in the build directory (usually '.nuxt'). If you delete the build directory, run \\`nuxt dev\\` to regenerate it.`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] When running your built application, preload Sentry via a command-line flag (\\`node --import ${serverConfigRelativePath} [...]\\`) or via an environment variable (\\`NODE_OPTIONS='--import ${serverConfigRelativePath}' node [...]\\`).`,\n );\n }\n });\n }\n }\n\n if (moduleOptions.autoInjectServerSentry === 'top-level-import') {\n addSentryTopImport(moduleOptions, nitro);\n }\n\n if (moduleOptions.autoInjectServerSentry === 'experimental_dynamic-import') {\n addDynamicImportEntryFileWrapper(nitro, serverConfigFile, moduleOptions);\n\n if (moduleOptions.debug) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Wrapping the server entry file with a dynamic `import()`, so Sentry can be preloaded before the server initializes.',\n );\n });\n }\n }\n }\n });\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;AAoBA,iBAAe,gBAAgB,CAAgB;AAC/C,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,qBAAqB;AAC/B,IAAI,SAAS,EAAE,QAAQ;AACvB,IAAI,aAAa,EAAE;AACnB,MAAM,IAAI,EAAE,SAAS;AACrB,KAAK;AACL,GAAG;AACH,EAAE,QAAQ,EAAE,EAAE;AACd,EAAE,KAAK,CAAC,kBAAkB,EAAE,IAAI,EAAE;AAClC,IAAI,IAAI,kBAAkB,EAAE,OAAA,KAAY,KAAK,EAAE;AAC/C,MAAM;AACN,IAAI;;AAEJ,IAAI,MAAM,gBAAgB;AAC1B,MAAM,GAAG,kBAAkB;AAC3B,MAAM,sBAAsB,EAAE,kBAAkB,CAAC,sBAAsB;AACvE,MAAM,uCAAuC,EAAE,kBAAkB,CAAC,2CAA2C;AAC7G,QAAQ,SAAS;AACjB,QAAQ,SAAS;AACjB,QAAQ,QAAQ;AAChB,OAAO;AACP,KAAK;;AAEL,IAAI,MAAM,iBAAA,GAAoB,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AAC7D,IAAI,MAAM,gBAAA,GAAmB,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;;AAElE,IAAI,MAAM,mBAAmB,sBAAsB,CAAC,QAAQ,EAAE,IAAI,CAAC;;AAEnE,IAAI,IAAI,gBAAgB,EAAE;AAC1B;AACA,MAAM,iBAAiB,CAAC;AACxB,QAAQ,IAAI,EAAE,QAAQ;AACtB,QAAQ,QAAQ,EAAE,0BAA0B;AAC5C,QAAQ,KAAK,EAAE,CAAC;;AAEhB;AACA;AACA,QAAQ,WAAW,EAAE,MAAM;AAC3B;;AAEA;AACA;AACA;AACA,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,EAAA,gBAAA,CAAA,sSAAA,CAAA;AACA,eAAA;;AAEA,cAAA,IAAA,KAAA,CAAA,OAAA,CAAA,GAAA,EAAA;AACA;AACA,gBAAA,OAAA,CAAA,GAAA;AACA,kBAAA,CAAA,iHAAA,EAAA,wBAAA,CAAA,mJAAA,CAAA;AACA,iBAAA;AACA,cAAA,CAAA,MAAA;AACA;AACA,gBAAA,OAAA,CAAA,GAAA;AACA,kBAAA,CAAA,sGAAA,EAAA,wBAAA,CAAA,mEAAA,EAAA,wBAAA,CAAA,gBAAA,CAAA;AACA,iBAAA;AACA,cAAA;AACA,YAAA,CAAA,CAAA;AACA,UAAA;AACA,QAAA;;AAEA,QAAA,IAAA,aAAA,CAAA,sBAAA,KAAA,kBAAA,EAAA;AACA,UAAA,kBAAA,CAAA,aAAA,EAAA,KAAA,CAAA;AACA,QAAA;;AAEA,QAAA,IAAA,aAAA,CAAA,sBAAA,KAAA,6BAAA,EAAA;AACA,UAAA,gCAAA,CAAA,KAAA,EAAA,gBAAA,EAAA,aAAA,CAAA;;AAEA,UAAA,IAAA,aAAA,CAAA,KAAA,EAAA;AACA,YAAA,cAAA,CAAA,MAAA;AACA;AACA,cAAA,OAAA,CAAA,GAAA;AACA,gBAAA,8HAAA;AACA,eAAA;AACA,YAAA,CAAA,CAAA;AACA,UAAA;AACA,QAAA;AACA,MAAA;AACA,IAAA,CAAA,CAAA;AACA,EAAA,CAAA;AACA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"module.js","sources":["../../src/module.ts"],"sourcesContent":["import {\n addPlugin,\n addPluginTemplate,\n addServerPlugin,\n addTemplate,\n createResolver,\n defineNuxtModule,\n} from '@nuxt/kit';\nimport { consoleSandbox } from '@sentry/core';\nimport * as path from 'path';\nimport type { SentryNuxtModuleOptions } from './common/types';\nimport { addDynamicImportEntryFileWrapper, addSentryTopImport, addServerConfigToBuild } from './vite/addServerConfig';\nimport { addDatabaseInstrumentation } from './vite/databaseConfig';\nimport { addMiddlewareImports, addMiddlewareInstrumentation } from './vite/middlewareConfig';\nimport { setupSourceMaps } from './vite/sourceMaps';\nimport { addStorageInstrumentation } from './vite/storageConfig';\nimport { addOTelCommonJSImportAlias, findDefaultSdkInitFile } from './vite/utils';\n\nexport type ModuleOptions = SentryNuxtModuleOptions;\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: '@sentry/nuxt/module',\n configKey: 'sentry',\n compatibility: {\n nuxt: '>=3.7.0',\n },\n },\n defaults: {},\n setup(moduleOptionsParam, nuxt) {\n if (moduleOptionsParam?.enabled === false) {\n return;\n }\n\n const moduleOptions = {\n ...moduleOptionsParam,\n autoInjectServerSentry: moduleOptionsParam.autoInjectServerSentry,\n experimental_entrypointWrappedFunctions: moduleOptionsParam.experimental_entrypointWrappedFunctions || [\n 'default',\n 'handler',\n 'server',\n ],\n };\n\n const moduleDirResolver = createResolver(import.meta.url);\n const buildDirResolver = createResolver(nuxt.options.buildDir);\n\n const clientConfigFile = findDefaultSdkInitFile('client', nuxt);\n\n if (clientConfigFile) {\n // Inject the client-side Sentry config file with a side effect import\n addPluginTemplate({\n mode: 'client',\n filename: 'sentry-client-config.mjs',\n order: 0,\n\n // Dynamic import of config file to wrap it within a Nuxt context (here: defineNuxtPlugin)\n // Makes it possible to call useRuntimeConfig() in the user-defined sentry config file\n getContents: () => `\n import { defineNuxtPlugin } from \"#imports\";\n\n export default defineNuxtPlugin({\n name: 'sentry-client-config',\n async setup() {\n await import(\"${buildDirResolver.resolve(`/${clientConfigFile}`)}\")\n }\n });`,\n });\n\n // Add the plugin which loads client integrations etc. -\n // this must run after the sentry-client-config plugin has run, and the client is initialized!\n addPlugin({\n src: moduleDirResolver.resolve('./runtime/plugins/sentry.client'),\n mode: 'client',\n order: 1,\n });\n }\n\n const serverConfigFile = findDefaultSdkInitFile('server', nuxt);\n\n if (serverConfigFile) {\n addServerPlugin(moduleDirResolver.resolve('./runtime/plugins/sentry.server'));\n\n addPlugin({\n src: moduleDirResolver.resolve('./runtime/plugins/route-detector.server'),\n mode: 'server',\n });\n }\n\n if (clientConfigFile || serverConfigFile) {\n setupSourceMaps(moduleOptions, nuxt);\n }\n\n addOTelCommonJSImportAlias(nuxt);\n\n const pagesDataTemplate = addTemplate({\n filename: 'sentry--nuxt-pages-data.mjs',\n // Initial empty array (later filled in pages:extend hook)\n // Template needs to be created in the root-level of the module to work\n getContents: () => 'export default [];',\n });\n\n nuxt.hooks.hook('pages:extend', pages => {\n pagesDataTemplate.getContents = () => {\n const pagesSubset = pages\n .map(page => ({ file: page.file, path: page.path }))\n .filter(page => {\n // Check for dynamic parameter (e.g., :userId or [userId])\n return page.path.includes(':') || page?.file?.includes('[');\n });\n\n return `export default ${JSON.stringify(pagesSubset, null, 2)};`;\n };\n });\n\n // Preps the the middleware instrumentation module.\n if (serverConfigFile) {\n addMiddlewareImports();\n addStorageInstrumentation(nuxt);\n addDatabaseInstrumentation(nuxt.options.nitro, moduleOptions);\n }\n\n // Add the sentry config file to the include array\n nuxt.hook('prepare:types', options => {\n const tsConfig = options.tsConfig as { include?: string[] };\n\n if (!tsConfig.include) {\n tsConfig.include = [];\n }\n\n // Add type references for useRuntimeConfig in root files for nuxt v4\n // Should be relative to `root/.nuxt`\n if (clientConfigFile) {\n const relativePath = path.relative(nuxt.options.buildDir, clientConfigFile);\n tsConfig.include.push(relativePath);\n }\n if (serverConfigFile) {\n const relativePath = path.relative(nuxt.options.buildDir, serverConfigFile);\n tsConfig.include.push(relativePath);\n }\n });\n\n nuxt.hooks.hook('nitro:init', nitro => {\n if (nuxt.options?._prepare) {\n return;\n }\n\n if (serverConfigFile) {\n addMiddlewareInstrumentation(nitro);\n }\n\n if (serverConfigFile?.includes('.server.config')) {\n consoleSandbox(() => {\n const serverDir = nitro.options.output.serverDir;\n\n // Netlify env: https://docs.netlify.com/configure-builds/environment-variables/#build-metadata\n if (serverDir.includes('.netlify') || !!process.env.NETLIFY) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Warning: The Sentry SDK detected a Netlify build. Server-side support for the Sentry Nuxt SDK on Netlify is currently unreliable due to technical limitations of serverless functions. Traces are not collected, and errors may occasionally not be reported. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',\n );\n }\n\n // Vercel env: https://vercel.com/docs/projects/environment-variables/system-environment-variables#VERCEL\n if (serverDir.includes('.vercel') || !!process.env.VERCEL) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Warning: The Sentry SDK detected a Vercel build. The Sentry Nuxt SDK currently does not support tracing on Vercel. For more information on setting up Sentry on the Nuxt server-side, please refer to the documentation: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/',\n );\n }\n });\n\n if (moduleOptions.autoInjectServerSentry !== 'experimental_dynamic-import') {\n addServerConfigToBuild(moduleOptions, nitro, serverConfigFile);\n\n if (moduleOptions.debug) {\n const serverDirResolver = createResolver(nitro.options.output.serverDir);\n const serverConfigPath = serverDirResolver.resolve('sentry.server.config.mjs');\n\n // For the default nitro node-preset build output this relative path would be: ./.output/server/sentry.server.config.mjs\n const serverConfigRelativePath = `.${path.sep}${path.relative(nitro.options.rootDir, serverConfigPath)}`;\n\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] Using \\`${serverConfigFile}\\` for server-side Sentry configuration. To activate Sentry on the Nuxt server-side, this file must be preloaded when starting your application. Make sure to add this where you deploy and/or run your application. Read more here: https://docs.sentry.io/platforms/javascript/guides/nuxt/install/.`,\n );\n\n if (nitro.options.dev) {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] During development, preload Sentry with the NODE_OPTIONS environment variable: \\`NODE_OPTIONS='--import ${serverConfigRelativePath}' nuxt dev\\`. The file is generated in the build directory (usually '.nuxt'). If you delete the build directory, run \\`nuxt dev\\` to regenerate it.`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.log(\n `[Sentry] When running your built application, preload Sentry via a command-line flag (\\`node --import ${serverConfigRelativePath} [...]\\`) or via an environment variable (\\`NODE_OPTIONS='--import ${serverConfigRelativePath}' node [...]\\`).`,\n );\n }\n });\n }\n }\n\n if (moduleOptions.autoInjectServerSentry === 'top-level-import') {\n addSentryTopImport(moduleOptions, nitro);\n }\n\n if (moduleOptions.autoInjectServerSentry === 'experimental_dynamic-import') {\n addDynamicImportEntryFileWrapper(nitro, serverConfigFile, moduleOptions);\n\n if (moduleOptions.debug) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] Wrapping the server entry file with a dynamic `import()`, so Sentry can be preloaded before the server initializes.',\n );\n });\n }\n }\n }\n });\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;AAoBA,iBAAe,gBAAgB,CAAgB;AAC/C,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,qBAAqB;AAC/B,IAAI,SAAS,EAAE,QAAQ;AACvB,IAAI,aAAa,EAAE;AACnB,MAAM,IAAI,EAAE,SAAS;AACrB,KAAK;AACL,GAAG;AACH,EAAE,QAAQ,EAAE,EAAE;AACd,EAAE,KAAK,CAAC,kBAAkB,EAAE,IAAI,EAAE;AAClC,IAAI,IAAI,kBAAkB,EAAE,OAAA,KAAY,KAAK,EAAE;AAC/C,MAAM;AACN,IAAI;;AAEJ,IAAI,MAAM,gBAAgB;AAC1B,MAAM,GAAG,kBAAkB;AAC3B,MAAM,sBAAsB,EAAE,kBAAkB,CAAC,sBAAsB;AACvE,MAAM,uCAAuC,EAAE,kBAAkB,CAAC,2CAA2C;AAC7G,QAAQ,SAAS;AACjB,QAAQ,SAAS;AACjB,QAAQ,QAAQ;AAChB,OAAO;AACP,KAAK;;AAEL,IAAI,MAAM,iBAAA,GAAoB,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AAC7D,IAAI,MAAM,gBAAA,GAAmB,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;;AAElE,IAAI,MAAM,mBAAmB,sBAAsB,CAAC,QAAQ,EA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.0"}
@@ -10,8 +10,9 @@ import { DEBUG_BUILD } from '../common/debug-build.js';
10
10
  * @param options Configuration options for the SDK.
11
11
  */
12
12
  function init(options) {
13
+ const envFallback = !isCjs() && import.meta.dev ? DEV_ENVIRONMENT : DEFAULT_ENVIRONMENT;
13
14
  const sentryOptions = {
14
- environment: !isCjs() && import.meta.dev ? DEV_ENVIRONMENT : DEFAULT_ENVIRONMENT,
15
+ environment: options.environment ?? process.env.SENTRY_ENVIRONMENT ?? envFallback,
15
16
  defaultIntegrations: getNuxtDefaultIntegrations(options),
16
17
  ...options,
17
18
  };
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sources":["../../../src/server/sdk.ts"],"sourcesContent":["import * as path from 'node:path';\nimport type { Client, Event, EventProcessor, Integration } from '@sentry/core';\nimport {\n applySdkMetadata,\n debug,\n DEFAULT_ENVIRONMENT,\n DEV_ENVIRONMENT,\n flush,\n getGlobalScope,\n vercelWaitUntil,\n} from '@sentry/core';\nimport {\n getDefaultIntegrations as getDefaultNodeIntegrations,\n httpIntegration,\n init as initNode,\n type NodeOptions,\n} from '@sentry/node';\nimport { isCjs } from '@sentry/node-core';\nimport { DEBUG_BUILD } from '../common/debug-build';\nimport type { SentryNuxtServerOptions } from '../common/types';\n\n/**\n * Initializes the server-side of the Nuxt SDK\n *\n * @param options Configuration options for the SDK.\n */\nexport function init(options: SentryNuxtServerOptions): Client | undefined {\n const sentryOptions = {\n environment: !isCjs() && import.meta.dev ? DEV_ENVIRONMENT : DEFAULT_ENVIRONMENT,\n defaultIntegrations: getNuxtDefaultIntegrations(options),\n ...options,\n };\n\n applySdkMetadata(sentryOptions, 'nuxt', ['nuxt', 'node']);\n\n const client = initNode(sentryOptions);\n\n getGlobalScope().addEventProcessor(lowQualityTransactionsFilter(options));\n getGlobalScope().addEventProcessor(clientSourceMapErrorFilter(options));\n\n return client;\n}\n\n/**\n * Filter out transactions for resource requests which we don't want to send to Sentry\n * for quota reasons.\n *\n * Only exported for testing\n */\nexport function lowQualityTransactionsFilter(options: SentryNuxtServerOptions): EventProcessor {\n return Object.assign(\n (event => {\n if (event.type !== 'transaction' || !event.transaction || isCacheEvent(event)) {\n return event;\n }\n\n // Check if this looks like a parametrized route (contains :param or :param() patterns)\n const hasRouteParameters = /\\/:[^(/\\s]*(\\([^)]*\\))?[^/\\s]*/.test(event.transaction);\n\n if (hasRouteParameters) {\n return event;\n }\n\n // We don't want to send transaction for file requests, so everything ending with a *.someExtension should be filtered out\n // path.extname will return an empty string for normal page requests\n if (path.extname(event.transaction)) {\n options.debug &&\n DEBUG_BUILD &&\n debug.log('NuxtLowQualityTransactionsFilter filtered transaction: ', event.transaction);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'NuxtLowQualityTransactionsFilter' },\n );\n}\n\n/**\n * The browser devtools try to get the source maps, but as client source maps may not be available there is going to be an error (no problem for the application though).\n *\n * Only exported for testing\n */\nexport function clientSourceMapErrorFilter(options: SentryNuxtServerOptions): EventProcessor {\n return Object.assign(\n (event => {\n const errorMsg = event.exception?.values?.[0]?.value;\n if (errorMsg?.match(/^ENOENT: no such file or directory, open '.*\\/_nuxt\\/.*\\.js\\.map'/)) {\n options.debug && DEBUG_BUILD && debug.log('NuxtClientSourceMapErrorFilter filtered error: ', errorMsg);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'NuxtClientSourceMapErrorFilter' },\n );\n}\n\nfunction getNuxtDefaultIntegrations(options: NodeOptions): Integration[] {\n return [\n ...getDefaultNodeIntegrations(options).filter(integration => integration.name !== 'Http'),\n // The httpIntegration is added as defaultIntegration, so users can still overwrite it\n httpIntegration({\n instrumentation: {\n responseHook: () => {\n // Makes it possible to end the tracing span before closing the Vercel lambda (https://vercel.com/docs/functions/functions-api-reference#waituntil)\n vercelWaitUntil(flushSafelyWithTimeout());\n },\n },\n }),\n ];\n}\n\n/**\n * Flushes pending Sentry events with a 2-second timeout and in a way that cannot create unhandled promise rejections.\n */\nasync function flushSafelyWithTimeout(): Promise<void> {\n try {\n DEBUG_BUILD && debug.log('Flushing events...');\n await flush(2000);\n DEBUG_BUILD && debug.log('Done flushing events');\n } catch (e) {\n DEBUG_BUILD && debug.log('Error while flushing events:\\n', e);\n }\n}\n\n/**\n * Checks if the event is a cache event.\n */\nfunction isCacheEvent(e: Event): boolean {\n return e.contexts?.trace?.origin === 'auto.cache.nuxt';\n}\n"],"names":["initNode","getDefaultNodeIntegrations"],"mappings":";;;;;;AAqBA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAA+C;AAC3E,EAAE,MAAM,gBAAgB;AACxB,IAAI,WAAW,EAAE,CAAC,KAAK,EAAC,IAAK,MAAM,CAAC,IAAI,CAAC,GAAA,GAAM,eAAA,GAAkB,mBAAmB;AACpF,IAAI,mBAAmB,EAAE,0BAA0B,CAAC,OAAO,CAAC;AAC5D,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAE,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;AAE3D,EAAE,MAAM,MAAA,GAASA,MAAQ,CAAC,aAAa,CAAC;;AAExC,EAAE,cAAc,EAAE,CAAC,iBAAiB,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC;AAC3E,EAAE,cAAc,EAAE,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC;;AAEzE,EAAE,OAAO,MAAM;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,4BAA4B,CAAC,OAAO,EAA2C;AAC/F,EAAE,OAAO,MAAM,CAAC,MAAM;AACtB,KAAK,SAAS;AACd,MAAM,IAAI,KAAK,CAAC,IAAA,KAAS,aAAA,IAAiB,CAAC,KAAK,CAAC,WAAA,IAAe,YAAY,CAAC,KAAK,CAAC,EAAE;AACrF,QAAQ,OAAO,KAAK;AACpB,MAAM;;AAEN;AACA,MAAM,MAAM,kBAAA,GAAqB,gCAAgC,CAAC,IAA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ACA,UAAU,eAAe,CAAC,sBAAsB,EAAE,CAAC;AACnD,QAAQ,CAAC;AACT,OAAO;AACP,KAAK,CAAC;AACN,GAAG;AACH;;AAEA;AACA;AACA;AACA,eAAe,sBAAsB,GAAkB;AACvD,EAAE,IAAI;AACN,IAAI,eAAe,KAAK,CAAC,GAAG,CAAC,oBAAoB,CAAC;AAClD,IAAI,MAAM,KAAK,CAAC,IAAI,CAAC;AACrB,IAAI,eAAe,KAAK,CAAC,GAAG,CAAC,sBAAsB,CAAC;AACpD,EAAE,CAAA,CAAE,OAAO,CAAC,EAAE;AACd,IAAI,WAAA,IAAe,KAAK,CAAC,GAAG,CAAC,gCAAgC,EAAE,CAAC,CAAC;AACjE,EAAE;AACF;;AAEA;AACA;AACA;AACA,SAAS,YAAY,CAAC,CAAC,EAAkB;AACzC,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAA,KAAW,iBAAiB;AACxD;;;;"}
1
+ {"version":3,"file":"sdk.js","sources":["../../../src/server/sdk.ts"],"sourcesContent":["import * as path from 'node:path';\nimport type { Client, Event, EventProcessor, Integration } from '@sentry/core';\nimport {\n applySdkMetadata,\n debug,\n DEFAULT_ENVIRONMENT,\n DEV_ENVIRONMENT,\n flush,\n getGlobalScope,\n vercelWaitUntil,\n} from '@sentry/core';\nimport {\n getDefaultIntegrations as getDefaultNodeIntegrations,\n httpIntegration,\n init as initNode,\n type NodeOptions,\n} from '@sentry/node';\nimport { isCjs } from '@sentry/node-core';\nimport { DEBUG_BUILD } from '../common/debug-build';\nimport type { SentryNuxtServerOptions } from '../common/types';\n\n/**\n * Initializes the server-side of the Nuxt SDK\n *\n * @param options Configuration options for the SDK.\n */\nexport function init(options: SentryNuxtServerOptions): Client | undefined {\n const envFallback = !isCjs() && import.meta.dev ? DEV_ENVIRONMENT : DEFAULT_ENVIRONMENT;\n const sentryOptions = {\n environment: options.environment ?? process.env.SENTRY_ENVIRONMENT ?? envFallback,\n defaultIntegrations: getNuxtDefaultIntegrations(options),\n ...options,\n };\n\n applySdkMetadata(sentryOptions, 'nuxt', ['nuxt', 'node']);\n\n const client = initNode(sentryOptions);\n\n getGlobalScope().addEventProcessor(lowQualityTransactionsFilter(options));\n getGlobalScope().addEventProcessor(clientSourceMapErrorFilter(options));\n\n return client;\n}\n\n/**\n * Filter out transactions for resource requests which we don't want to send to Sentry\n * for quota reasons.\n *\n * Only exported for testing\n */\nexport function lowQualityTransactionsFilter(options: SentryNuxtServerOptions): EventProcessor {\n return Object.assign(\n (event => {\n if (event.type !== 'transaction' || !event.transaction || isCacheEvent(event)) {\n return event;\n }\n\n // Check if this looks like a parametrized route (contains :param or :param() patterns)\n const hasRouteParameters = /\\/:[^(/\\s]*(\\([^)]*\\))?[^/\\s]*/.test(event.transaction);\n\n if (hasRouteParameters) {\n return event;\n }\n\n // We don't want to send transaction for file requests, so everything ending with a *.someExtension should be filtered out\n // path.extname will return an empty string for normal page requests\n if (path.extname(event.transaction)) {\n options.debug &&\n DEBUG_BUILD &&\n debug.log('NuxtLowQualityTransactionsFilter filtered transaction: ', event.transaction);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'NuxtLowQualityTransactionsFilter' },\n );\n}\n\n/**\n * The browser devtools try to get the source maps, but as client source maps may not be available there is going to be an error (no problem for the application though).\n *\n * Only exported for testing\n */\nexport function clientSourceMapErrorFilter(options: SentryNuxtServerOptions): EventProcessor {\n return Object.assign(\n (event => {\n const errorMsg = event.exception?.values?.[0]?.value;\n if (errorMsg?.match(/^ENOENT: no such file or directory, open '.*\\/_nuxt\\/.*\\.js\\.map'/)) {\n options.debug && DEBUG_BUILD && debug.log('NuxtClientSourceMapErrorFilter filtered error: ', errorMsg);\n return null;\n }\n return event;\n }) satisfies EventProcessor,\n { id: 'NuxtClientSourceMapErrorFilter' },\n );\n}\n\nfunction getNuxtDefaultIntegrations(options: NodeOptions): Integration[] {\n return [\n ...getDefaultNodeIntegrations(options).filter(integration => integration.name !== 'Http'),\n // The httpIntegration is added as defaultIntegration, so users can still overwrite it\n httpIntegration({\n instrumentation: {\n responseHook: () => {\n // Makes it possible to end the tracing span before closing the Vercel lambda (https://vercel.com/docs/functions/functions-api-reference#waituntil)\n vercelWaitUntil(flushSafelyWithTimeout());\n },\n },\n }),\n ];\n}\n\n/**\n * Flushes pending Sentry events with a 2-second timeout and in a way that cannot create unhandled promise rejections.\n */\nasync function flushSafelyWithTimeout(): Promise<void> {\n try {\n DEBUG_BUILD && debug.log('Flushing events...');\n await flush(2000);\n DEBUG_BUILD && debug.log('Done flushing events');\n } catch (e) {\n DEBUG_BUILD && debug.log('Error while flushing events:\\n', e);\n }\n}\n\n/**\n * Checks if the event is a cache event.\n */\nfunction isCacheEvent(e: Event): boolean {\n return e.contexts?.trace?.origin === 'auto.cache.nuxt';\n}\n"],"names":["initNode","getDefaultNodeIntegrations"],"mappings":";;;;;;AAqBA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAA+C;AAC3E,EAAE,MAAM,WAAA,GAAc,CAAC,KAAK,EAAC,IAAK,MAAM,CAAC,IAAI,CAAC,GAAA,GAAM,eAAA,GAAkB,mBAAmB;AACzF,EAAE,MAAM,gBAAgB;AACxB,IAAI,WAAW,EAAE,OAAO,CAAC,WAAA,IAAe,OAAO,CAAC,GAAG,CAAC,kBAAA,IAAsB,WAAW;AACrF,IAAI,mBAAmB,EAAE,0BAA0B,CAAC,OAAO,CAAC;AAC5D,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAE,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;AAE3D,EAAE,MAAM,MAAA,GAASA,MAAQ,CAAC,aAAa,CAAC;;AAExC,EAAE,cAAc,EAAE,CAAC,iBAAiB,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC;AAC3E,EAAE,cAAc,EAAE,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC;;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N,MAAM,OAAO,KAAK;AAClB,IAAI,CAAC;AACL,IAAI,EAAE,EAAE,EAAE,gCAAA,EAAkC;AAC5C,GAAG;AACH;;AAEA,SAAS,0BAA0B,CAAC,OAAO,EAA8B;AACzE,EAAE,OAAO;AACT,IAAI,GAAGC,sBAA0B,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,WAAA,IAAe,WAAW,CAAC,IAAA,KAAS,MAAM,CAAC;AAC7F;AACA,IAAI,eAAe,CAAC;AACpB,MAAM,eAAe,EAAE;AACvB,QAAQ,YAAY,EAAE,MAAM;AAC5B;AACA,UAAU,eAAe,CAAC,sBAAsB,EAAE,CAAC;AACnD,QAAQ,CAAC;AACT,OAAO;AACP,KAAK,CAAC;AACN,GAAG;AACH;;AAEA;AACA;AACA;AACA,eAAe,sBAAsB,GAAkB;AACvD,EAAE,IAAI;AACN,IAAI,eAAe,KAAK,CAAC,GAAG,CAAC,oBAAoB,CAAC;AAClD,IAAI,MAAM,KAAK,CAAC,IAAI,CAAC;AACrB,IAAI,eAAe,KAAK,CAAC,GAAG,CAAC,sBAAsB,CAAC;AACpD,EAAE,CAAA,CAAE,OAAO,CAAC,EAAE;AACd,IAAI,WAAA,IAAe,KAAK,CAAC,GAAG,CAAC,gCAAgC,EAAE,CAAC,CAAC;AACjE,EAAE;AACF;;AAEA;AACA;AACA;AACA,SAAS,YAAY,CAAC,CAAC,EAAkB;AACzC,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAA,KAAW,iBAAiB;AACxD;;;;"}
@@ -5,14 +5,17 @@ import { addServerTemplate } from '../vendor/server-template.js';
5
5
  /**
6
6
  * Sets up the database instrumentation.
7
7
  */
8
- function addDatabaseInstrumentation(nitro) {
8
+ function addDatabaseInstrumentation(nitro, moduleOptions) {
9
9
  if (!nitro.experimental?.database) {
10
- consoleSandbox(() => {
11
- // eslint-disable-next-line no-console
12
- console.log(
13
- '[Sentry] [Nitro Database Plugin]: No database configuration found. Skipping database instrumentation.',
14
- );
15
- });
10
+ // We cannot use DEBUG_BUILD here because it is a runtime flag, so it is not available for build time scripts
11
+ // So we have to pass in the module options to the build time script
12
+ moduleOptions?.debug &&
13
+ consoleSandbox(() => {
14
+ // eslint-disable-next-line no-console
15
+ console.log(
16
+ '[Sentry] [Nitro Database Plugin]: No database configuration found. Skipping database instrumentation.',
17
+ );
18
+ });
16
19
 
17
20
  return;
18
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"databaseConfig.js","sources":["../../../src/vite/databaseConfig.ts"],"sourcesContent":["import { addServerPlugin, createResolver } from '@nuxt/kit';\nimport { consoleSandbox } from '@sentry/core';\nimport type { NitroConfig } from 'nitropack/types';\nimport { addServerTemplate } from '../vendor/server-template';\n\n/**\n * Sets up the database instrumentation.\n */\nexport function addDatabaseInstrumentation(nitro: NitroConfig): void {\n if (!nitro.experimental?.database) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] [Nitro Database Plugin]: No database configuration found. Skipping database instrumentation.',\n );\n });\n\n return;\n }\n\n /**\n * This is a different option than the one in `experimental.database`, this configures multiple database instances.\n * keys represent database names to be passed to `useDatabase(name?)`.\n * We also use the config to populate database span attributes.\n * https://nitro.build/guide/database#configuration\n */\n const databaseConfig = nitro.database || { default: {} };\n\n // Create a virtual module to pass this data to runtime\n addServerTemplate({\n filename: '#sentry/database-config.mjs',\n getContents: () => {\n return `export const databaseConfig = ${JSON.stringify(databaseConfig)};`;\n },\n });\n\n addServerPlugin(createResolver(import.meta.url).resolve('./runtime/plugins/database.server'));\n}\n"],"names":[],"mappings":";;;;AAKA;AACA;AACA;AACO,SAAS,0BAA0B,CAAC,KAAK,EAAqB;AACrE,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,QAAQ,EAAE;AACrC,IAAI,cAAc,CAAC,MAAM;AACzB;AACA,MAAM,OAAO,CAAC,GAAG;AACjB,QAAQ,uGAAuG;AAC/G,OAAO;AACP,IAAI,CAAC,CAAC;;AAEN,IAAI;AACJ,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,MAAM,cAAA,GAAiB,KAAK,CAAC,QAAA,IAAY,EAAE,OAAO,EAAE,EAAC,EAAG;;AAE1D;AACA,EAAE,iBAAiB,CAAC;AACpB,IAAI,QAAQ,EAAE,6BAA6B;AAC3C,IAAI,WAAW,EAAE,MAAM;AACvB,MAAM,OAAO,CAAC,8BAA8B,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAC/E,IAAI,CAAC;AACL,GAAG,CAAC;;AAEJ,EAAE,eAAe,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC/F;;;;"}
1
+ {"version":3,"file":"databaseConfig.js","sources":["../../../src/vite/databaseConfig.ts"],"sourcesContent":["import { addServerPlugin, createResolver } from '@nuxt/kit';\nimport { consoleSandbox } from '@sentry/core';\nimport type { NitroConfig } from 'nitropack/types';\nimport type { SentryNuxtModuleOptions } from '../common/types';\nimport { addServerTemplate } from '../vendor/server-template';\n\n/**\n * Sets up the database instrumentation.\n */\nexport function addDatabaseInstrumentation(nitro: NitroConfig, moduleOptions?: SentryNuxtModuleOptions): void {\n if (!nitro.experimental?.database) {\n // We cannot use DEBUG_BUILD here because it is a runtime flag, so it is not available for build time scripts\n // So we have to pass in the module options to the build time script\n moduleOptions?.debug &&\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.log(\n '[Sentry] [Nitro Database Plugin]: No database configuration found. Skipping database instrumentation.',\n );\n });\n\n return;\n }\n\n /**\n * This is a different option than the one in `experimental.database`, this configures multiple database instances.\n * keys represent database names to be passed to `useDatabase(name?)`.\n * We also use the config to populate database span attributes.\n * https://nitro.build/guide/database#configuration\n */\n const databaseConfig = nitro.database || { default: {} };\n\n // Create a virtual module to pass this data to runtime\n addServerTemplate({\n filename: '#sentry/database-config.mjs',\n getContents: () => {\n return `export const databaseConfig = ${JSON.stringify(databaseConfig)};`;\n },\n });\n\n addServerPlugin(createResolver(import.meta.url).resolve('./runtime/plugins/database.server'));\n}\n"],"names":[],"mappings":";;;;AAMA;AACA;AACA;AACO,SAAS,0BAA0B,CAAC,KAAK,EAAe,aAAa,EAAkC;AAC9G,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,QAAQ,EAAE;AACrC;AACA;AACA,IAAI,aAAa,EAAE,KAAA;AACnB,MAAM,cAAc,CAAC,MAAM;AAC3B;AACA,QAAQ,OAAO,CAAC,GAAG;AACnB,UAAU,uGAAuG;AACjH,SAAS;AACT,MAAM,CAAC,CAAC;;AAER,IAAI;AACJ,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,MAAM,cAAA,GAAiB,KAAK,CAAC,QAAA,IAAY,EAAE,OAAO,EAAE,EAAC,EAAG;;AAE1D;AACA,EAAE,iBAAiB,CAAC;AACpB,IAAI,QAAQ,EAAE,6BAA6B;AAC3C,IAAI,WAAW,EAAE,MAAM;AACvB,MAAM,OAAO,CAAC,8BAA8B,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAC/E,IAAI,CAAC;AACL,GAAG,CAAC;;AAEJ,EAAE,eAAe,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC/F;;;;"}
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.7.0"
6
6
  },
7
- "version": "10.38.0",
7
+ "version": "10.39.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -262,9 +262,9 @@ function addServerTemplate(template) {
262
262
  return template;
263
263
  }
264
264
 
265
- function addDatabaseInstrumentation(nitro) {
265
+ function addDatabaseInstrumentation(nitro, moduleOptions) {
266
266
  if (!nitro.experimental?.database) {
267
- consoleSandbox(() => {
267
+ moduleOptions?.debug && consoleSandbox(() => {
268
268
  console.log(
269
269
  "[Sentry] [Nitro Database Plugin]: No database configuration found. Skipping database instrumentation."
270
270
  );
@@ -687,7 +687,7 @@ const module = defineNuxtModule({
687
687
  if (serverConfigFile) {
688
688
  addMiddlewareImports();
689
689
  addStorageInstrumentation(nuxt);
690
- addDatabaseInstrumentation(nuxt.options.nitro);
690
+ addDatabaseInstrumentation(nuxt.options.nitro, moduleOptions);
691
691
  }
692
692
  nuxt.hook("prepare:types", (options) => {
693
693
  const tsConfig = options.tsConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/client/sdk.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,GAAG,SAAS,CAWzE"}
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/client/sdk.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,GAAG,SAAS,CAYzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/server/sdk.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAS,cAAc,EAAe,MAAM,cAAc,CAAC;AAkB/E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,GAAG,SAAS,CAezE;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,uBAAuB,GAAG,cAAc,CA0B7F;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,uBAAuB,GAAG,cAAc,CAY3F"}
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/server/sdk.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAS,cAAc,EAAe,MAAM,cAAc,CAAC;AAkB/E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,GAAG,SAAS,CAgBzE;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,uBAAuB,GAAG,cAAc,CA0B7F;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,uBAAuB,GAAG,cAAc,CAY3F"}
@@ -1,6 +1,7 @@
1
1
  import type { NitroConfig } from 'nitropack/types';
2
+ import type { SentryNuxtModuleOptions } from '../common/types';
2
3
  /**
3
4
  * Sets up the database instrumentation.
4
5
  */
5
- export declare function addDatabaseInstrumentation(nitro: NitroConfig): void;
6
+ export declare function addDatabaseInstrumentation(nitro: NitroConfig, moduleOptions?: SentryNuxtModuleOptions): void;
6
7
  //# sourceMappingURL=databaseConfig.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"databaseConfig.d.ts","sourceRoot":"","sources":["../../../src/vite/databaseConfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGnD;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CA6BnE"}
1
+ {"version":3,"file":"databaseConfig.d.ts","sourceRoot":"","sources":["../../../src/vite/databaseConfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAG/D;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,WAAW,EAAE,aAAa,CAAC,EAAE,uBAAuB,GAAG,IAAI,CAgC5G"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/nuxt",
3
- "version": "10.38.0",
3
+ "version": "10.39.0",
4
4
  "description": "Official Sentry SDK for Nuxt",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/nuxt",
@@ -49,14 +49,14 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@nuxt/kit": "^3.13.2",
52
- "@sentry/browser": "10.38.0",
53
- "@sentry/cloudflare": "10.38.0",
54
- "@sentry/core": "10.38.0",
55
- "@sentry/node": "10.38.0",
56
- "@sentry/node-core": "10.38.0",
52
+ "@sentry/browser": "10.39.0",
53
+ "@sentry/cloudflare": "10.39.0",
54
+ "@sentry/core": "10.39.0",
55
+ "@sentry/node": "10.39.0",
56
+ "@sentry/node-core": "10.39.0",
57
57
  "@sentry/rollup-plugin": "^4.8.0",
58
58
  "@sentry/vite-plugin": "^4.8.0",
59
- "@sentry/vue": "10.38.0"
59
+ "@sentry/vue": "10.39.0"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@nuxt/module-builder": "^0.8.4",