File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
packages/clerk-js/src/core Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @clerk/clerk-js " : patch
3
+ ---
4
+
5
+ feat(clerk-js): Enable debugLogger for Next.js keyless applications.
Original file line number Diff line number Diff line change @@ -476,10 +476,21 @@ export class Clerk implements ClerkInterface {
476
476
} else {
477
477
await this . #loadInNonStandardBrowser( ) ;
478
478
}
479
- if ( this . environment ?. clientDebugMode ) {
479
+ const telemetry = this . #options. telemetry ;
480
+ const telemetryEnabled = telemetry !== false && ! telemetry ?. disabled ;
481
+
482
+ const isKeyless = Boolean ( this . #options. __internal_keyless_claimKeylessApplicationUrl ) ;
483
+ const hasClientDebugMode = Boolean ( this . environment ?. clientDebugMode ) ;
484
+ const isProd = this . environment ?. isProduction ?.( ) ?? false ;
485
+
486
+ const shouldEnable = hasClientDebugMode || ( isKeyless && ! isProd ) ;
487
+ const logLevel = isKeyless && ! hasClientDebugMode ? 'error' : undefined ;
488
+
489
+ if ( shouldEnable ) {
480
490
initDebugLogger ( {
481
491
enabled : true ,
482
- telemetryCollector : this . telemetry ,
492
+ ...( logLevel ? { logLevel } : { } ) ,
493
+ ...( telemetryEnabled && this . telemetry ? { telemetryCollector : this . telemetry } : { } ) ,
483
494
} ) ;
484
495
}
485
496
debugLogger . info ( 'load() complete' , { } , 'clerk' ) ;
You can’t perform that action at this time.
0 commit comments