66 addInstrumentationHandler ,
77 getEventDescription ,
88 htmlTreeAsString ,
9+ logger ,
910 parseUrl ,
1011 safeJoin ,
1112 severityLevelFromString ,
@@ -20,7 +21,6 @@ interface BreadcrumbsOptions {
2021 | boolean
2122 | {
2223 serializeAttribute ?: string | string [ ] ;
23- /** maxStringLength gets capped at 1024 to prevent 100 breadcrumbs exceeding 1MB event payload size */
2424 maxStringLength ?: number ;
2525 } ;
2626 fetch : boolean ;
@@ -29,6 +29,9 @@ interface BreadcrumbsOptions {
2929 xhr : boolean ;
3030}
3131
32+ /** maxStringLength gets capped to prevent 100 breadcrumbs exceeding 1MB event payload size */
33+ const MAX_ALLOWED_STRING_LENGTH = 1024 ;
34+
3235export const BREADCRUMB_INTEGRATION_ID = 'Breadcrumbs' ;
3336
3437/**
@@ -123,10 +126,17 @@ function _domBreadcrumb(dom: BreadcrumbsOptions['dom']): (handlerData: { [key: s
123126 function _innerDomBreadcrumb ( handlerData : { [ key : string ] : any } ) : void {
124127 let target ;
125128 let keyAttrs = typeof dom === 'object' ? dom . serializeAttribute : undefined ;
126- const maxStringLength =
127- typeof dom === 'object' && typeof dom . maxStringLength === 'number'
128- ? Math . min ( dom . maxStringLength , 1024 )
129- : undefined ;
129+
130+ let maxStringLength =
131+ typeof dom === 'object' && typeof dom . maxStringLength === 'number' ? dom . maxStringLength : undefined ;
132+ if ( maxStringLength && maxStringLength > MAX_ALLOWED_STRING_LENGTH ) {
133+ if ( __DEBUG_BUILD__ ) {
134+ logger . warn (
135+ `\`dom.maxStringLength\` cannot exceed ${ MAX_ALLOWED_STRING_LENGTH } , but a value of ${ maxStringLength } was configured. Sentry will use ${ MAX_ALLOWED_STRING_LENGTH } instead.` ,
136+ ) ;
137+ }
138+ maxStringLength = MAX_ALLOWED_STRING_LENGTH ;
139+ }
130140
131141 if ( typeof keyAttrs === 'string' ) {
132142 keyAttrs = [ keyAttrs ] ;
0 commit comments