File tree Expand file tree Collapse file tree 3 files changed +13
-11
lines changed Expand file tree Collapse file tree 3 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ export default defineNuxtModule<ModuleOptions>({
129129 if ( serverConfigFile ) {
130130 addMiddlewareImports ( ) ;
131131 addStorageInstrumentation ( nuxt ) ;
132- addDatabaseInstrumentation ( nuxt ) ;
132+ addDatabaseInstrumentation ( nuxt . options . nitro ) ;
133133 }
134134
135135 nuxt . hooks . hook ( 'nitro:init' , nitro => {
Original file line number Diff line number Diff line change @@ -31,23 +31,23 @@ const SENTRY_ORIGIN = 'auto.db.nuxt';
3131 */
3232export default defineNitroPlugin ( ( ) => {
3333 try {
34- debug . log ( '@sentry/nuxt : Instrumenting databases...' ) ;
34+ debug . log ( '[Nitro Database Plugin] : Instrumenting databases...' ) ;
3535
3636 for ( const instance of databaseInstances ) {
37- debug . log ( '@sentry/nuxt : Instrumenting database instance:' , instance ) ;
37+ debug . log ( '[Nitro Database Plugin] : Instrumenting database instance:' , instance ) ;
3838 const db = useDatabase ( instance ) ;
3939 instrumentDatabase ( db ) ;
4040 }
4141
42- debug . log ( '@sentry/nuxt : Databases instrumented.' ) ;
42+ debug . log ( '[Nitro Database Plugin] : Databases instrumented.' ) ;
4343 } catch ( error ) {
4444 // During build time, we can't use the useDatabase function, so we just log an error.
4545 if ( error instanceof Error && / C a n n o t a c c e s s ' i n s t a n c e s ' / . test ( error . message ) ) {
46- debug . log ( '@sentry/nuxt : Database instrumentation skipped during build time.' ) ;
46+ debug . log ( '[Nitro Database Plugin] : Database instrumentation skipped during build time.' ) ;
4747 return ;
4848 }
4949
50- debug . error ( '@sentry/nuxt : Failed to instrument database:' , error ) ;
50+ debug . error ( '[Nitro Database Plugin] : Failed to instrument database:' , error ) ;
5151 }
5252} ) ;
5353
Original file line number Diff line number Diff line change 11import { addServerPlugin , createResolver } from '@nuxt/kit' ;
22import { consoleSandbox } from '@sentry/core' ;
3- import type { Nuxt } from 'nuxt/schema ' ;
3+ import type { NitroConfig } from 'nitropack/types ' ;
44import { addServerTemplate } from '../vendor/server-template' ;
55
66/**
77 * Sets up the database instrumentation.
88 */
9- export function addDatabaseInstrumentation ( nuxt : Nuxt ) : void {
10- if ( ! nuxt . options . nitro ? .experimental ?. database ) {
9+ export function addDatabaseInstrumentation ( nitro : NitroConfig ) : void {
10+ if ( ! nitro . experimental ?. database ) {
1111 consoleSandbox ( ( ) => {
1212 // eslint-disable-next-line no-console
13- console . log ( '[Sentry] No database configuration found. Skipping database instrumentation.' ) ;
13+ console . log (
14+ '[Sentry] [Nitro Database Plugin]: No database configuration found. Skipping database instrumentation.' ,
15+ ) ;
1416 } ) ;
1517
1618 return ;
@@ -21,7 +23,7 @@ export function addDatabaseInstrumentation(nuxt: Nuxt): void {
2123 * keys represent database names to be passed to `useDatabase(name?)`.
2224 * https://nitro.build/guide/database#configuration
2325 */
24- const databaseInstances = Object . keys ( nuxt . options . nitro . database || { default : { } } ) ;
26+ const databaseInstances = Object . keys ( nitro . database || { default : { } } ) ;
2527
2628 // Create a virtual module to pass this data to runtime
2729 addServerTemplate ( {
You can’t perform that action at this time.
0 commit comments