@sentry/replay 7.81.1 → 7.83.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.
- package/cjs/index.js +180 -70
- package/cjs/index.js.map +1 -1
- package/esm/index.js +182 -72
- package/esm/index.js.map +1 -1
- package/package.json +6 -6
- package/types/coreHandlers/handleDom.d.ts +3 -4
- package/types/coreHandlers/handleDom.d.ts.map +1 -1
- package/types/coreHandlers/handleFetch.d.ts +1 -1
- package/types/coreHandlers/handleGlobalEvent.d.ts.map +1 -1
- package/types/coreHandlers/handleHistory.d.ts +3 -7
- package/types/coreHandlers/handleHistory.d.ts.map +1 -1
- package/types/coreHandlers/handleNetworkBreadcrumbs.d.ts.map +1 -1
- package/types/coreHandlers/handleXhr.d.ts +1 -1
- package/types/coreHandlers/util/domUtils.d.ts +1 -7
- package/types/coreHandlers/util/domUtils.d.ts.map +1 -1
- package/types/coreHandlers/util/fetchUtils.d.ts +5 -1
- package/types/coreHandlers/util/fetchUtils.d.ts.map +1 -1
- package/types/coreHandlers/util/networkUtils.d.ts +4 -4
- package/types/coreHandlers/util/networkUtils.d.ts.map +1 -1
- package/types/coreHandlers/util/xhrUtils.d.ts.map +1 -1
- package/types/debug-build.d.ts +7 -0
- package/types/debug-build.d.ts.map +1 -0
- package/types/eventBuffer/EventBufferProxy.d.ts.map +1 -1
- package/types/eventBuffer/WorkerHandler.d.ts.map +1 -1
- package/types/replay.d.ts.map +1 -1
- package/types/types/performance.d.ts +1 -1
- package/types/types/performance.d.ts.map +1 -1
- package/types/types/request.d.ts +1 -1
- package/types/types/request.d.ts.map +1 -1
- package/types/util/addEvent.d.ts.map +1 -1
- package/types/util/getPrivacyOptions.d.ts.map +1 -1
- package/types/util/handleRecordingEmit.d.ts.map +1 -1
- package/types/util/log.d.ts.map +1 -1
- package/types/util/sendReplay.d.ts.map +1 -1
- package/types/util/shouldFilterRequest.d.ts.map +1 -1
- package/types-ts3.8/coreHandlers/handleDom.d.ts +3 -4
- package/types-ts3.8/coreHandlers/handleFetch.d.ts +1 -1
- package/types-ts3.8/coreHandlers/handleHistory.d.ts +3 -7
- package/types-ts3.8/coreHandlers/handleXhr.d.ts +1 -1
- package/types-ts3.8/coreHandlers/util/domUtils.d.ts +1 -7
- package/types-ts3.8/coreHandlers/util/fetchUtils.d.ts +5 -1
- package/types-ts3.8/coreHandlers/util/networkUtils.d.ts +7 -4
- package/types-ts3.8/debug-build.d.ts +7 -0
- package/types-ts3.8/types/performance.d.ts +1 -1
- package/types-ts3.8/types/request.d.ts +1 -1
package/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getCurrentHub, isSentryRequestUrl, addGlobalEventProcessor, prepareEvent, setContext, captureException } from '@sentry/core';
|
|
2
|
-
import { GLOBAL_OBJ, normalize, fill, htmlTreeAsString, browserPerformanceTimeOrigin, logger, uuid4, SENTRY_XHR_DATA_KEY, dropUndefinedKeys, stringMatchesSomePattern,
|
|
1
|
+
import { getCurrentHub, getClient, isSentryRequestUrl, addGlobalEventProcessor, prepareEvent, setContext, captureException } from '@sentry/core';
|
|
2
|
+
import { GLOBAL_OBJ, normalize, fill, htmlTreeAsString, browserPerformanceTimeOrigin, logger, uuid4, SENTRY_XHR_DATA_KEY, dropUndefinedKeys, stringMatchesSomePattern, addFetchInstrumentationHandler, addXhrInstrumentationHandler, addClickKeypressInstrumentationHandler, addHistoryInstrumentationHandler, createEnvelope, createEventEnvelopeHeaders, getSdkMetadataForEnvelopeHeader, updateRateLimits, isRateLimited, consoleSandbox, isBrowser } from '@sentry/utils';
|
|
3
3
|
import { addPerformanceInstrumentationHandler, addLcpInstrumentationHandler } from '@sentry-internal/tracing';
|
|
4
4
|
|
|
5
5
|
// exporting a separate copy of `WINDOW` rather than exporting the one from `@sentry/browser`
|
|
@@ -4339,12 +4339,13 @@ const handleDomListener = (
|
|
|
4339
4339
|
}
|
|
4340
4340
|
|
|
4341
4341
|
const isClick = handlerData.name === 'click';
|
|
4342
|
-
const event = isClick
|
|
4342
|
+
const event = isClick ? (handlerData.event ) : undefined;
|
|
4343
4343
|
// Ignore clicks if ctrl/alt/meta/shift keys are held down as they alter behavior of clicks (e.g. open in new tab)
|
|
4344
4344
|
if (
|
|
4345
4345
|
isClick &&
|
|
4346
4346
|
replay.clickDetector &&
|
|
4347
4347
|
event &&
|
|
4348
|
+
event.target &&
|
|
4348
4349
|
!event.altKey &&
|
|
4349
4350
|
!event.metaKey &&
|
|
4350
4351
|
!event.ctrlKey &&
|
|
@@ -4353,7 +4354,7 @@ const handleDomListener = (
|
|
|
4353
4354
|
handleClick(
|
|
4354
4355
|
replay.clickDetector,
|
|
4355
4356
|
result ,
|
|
4356
|
-
getClickTargetNode(handlerData.event) ,
|
|
4357
|
+
getClickTargetNode(handlerData.event ) ,
|
|
4357
4358
|
);
|
|
4358
4359
|
}
|
|
4359
4360
|
|
|
@@ -4409,7 +4410,7 @@ function getDomTarget(handlerData) {
|
|
|
4409
4410
|
|
|
4410
4411
|
// Accessing event.target can throw (see getsentry/raven-js#838, #768)
|
|
4411
4412
|
try {
|
|
4412
|
-
target = isClick ? getClickTargetNode(handlerData.event) : getTargetNode(handlerData.event);
|
|
4413
|
+
target = isClick ? getClickTargetNode(handlerData.event ) : getTargetNode(handlerData.event );
|
|
4413
4414
|
message = htmlTreeAsString(target, { maxStringLength: 200 }) || '<unknown>';
|
|
4414
4415
|
} catch (e) {
|
|
4415
4416
|
message = '<unknown>';
|
|
@@ -4671,6 +4672,13 @@ function setupPerformanceObserver(replay) {
|
|
|
4671
4672
|
};
|
|
4672
4673
|
}
|
|
4673
4674
|
|
|
4675
|
+
/**
|
|
4676
|
+
* This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.
|
|
4677
|
+
*
|
|
4678
|
+
* ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
|
|
4679
|
+
*/
|
|
4680
|
+
const DEBUG_BUILD = (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__);
|
|
4681
|
+
|
|
4674
4682
|
const r = `var t=Uint8Array,n=Uint16Array,r=Int32Array,e=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=function(t,e){for(var i=new n(31),a=0;a<31;++a)i[a]=e+=1<<t[a-1];var s=new r(i[30]);for(a=1;a<30;++a)for(var o=i[a];o<i[a+1];++o)s[o]=o-i[a]<<5|a;return{b:i,r:s}},o=s(e,2),f=o.b,h=o.r;f[28]=258,h[258]=28;for(var l=s(i,0).r,u=new n(32768),c=0;c<32768;++c){var v=(43690&c)>>1|(21845&c)<<1;v=(61680&(v=(52428&v)>>2|(13107&v)<<2))>>4|(3855&v)<<4,u[c]=((65280&v)>>8|(255&v)<<8)>>1}var d=function(t,r,e){for(var i=t.length,a=0,s=new n(r);a<i;++a)t[a]&&++s[t[a]-1];var o,f=new n(r);for(a=1;a<r;++a)f[a]=f[a-1]+s[a-1]<<1;if(e){o=new n(1<<r);var h=15-r;for(a=0;a<i;++a)if(t[a])for(var l=a<<4|t[a],c=r-t[a],v=f[t[a]-1]++<<c,d=v|(1<<c)-1;v<=d;++v)o[u[v]>>h]=l}else for(o=new n(i),a=0;a<i;++a)t[a]&&(o[a]=u[f[t[a]-1]++]>>15-t[a]);return o},g=new t(288);for(c=0;c<144;++c)g[c]=8;for(c=144;c<256;++c)g[c]=9;for(c=256;c<280;++c)g[c]=7;for(c=280;c<288;++c)g[c]=8;var w=new t(32);for(c=0;c<32;++c)w[c]=5;var p=d(g,9,0),y=d(w,5,0),m=function(t){return(t+7)/8|0},b=function(n,r,e){return(null==r||r<0)&&(r=0),(null==e||e>n.length)&&(e=n.length),new t(n.subarray(r,e))},M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(t,n,r){var e=new Error(n||M[t]);if(e.code=t,Error.captureStackTrace&&Error.captureStackTrace(e,E),!r)throw e;return e},z=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8},A=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8,t[e+2]|=r>>16},_=function(r,e){for(var i=[],a=0;a<r.length;++a)r[a]&&i.push({s:a,f:r[a]});var s=i.length,o=i.slice();if(!s)return{t:F,l:0};if(1==s){var f=new t(i[0].s+1);return f[i[0].s]=1,{t:f,l:1}}i.sort((function(t,n){return t.f-n.f})),i.push({s:-1,f:25001});var h=i[0],l=i[1],u=0,c=1,v=2;for(i[0]={s:-1,f:h.f+l.f,l:h,r:l};c!=s-1;)h=i[i[u].f<i[v].f?u++:v++],l=i[u!=c&&i[u].f<i[v].f?u++:v++],i[c++]={s:-1,f:h.f+l.f,l:h,r:l};var d=o[0].s;for(a=1;a<s;++a)o[a].s>d&&(d=o[a].s);var g=new n(d+1),w=x(i[c-1],g,0);if(w>e){a=0;var p=0,y=w-e,m=1<<y;for(o.sort((function(t,n){return g[n.s]-g[t.s]||t.f-n.f}));a<s;++a){var b=o[a].s;if(!(g[b]>e))break;p+=m-(1<<w-g[b]),g[b]=e}for(p>>=y;p>0;){var M=o[a].s;g[M]<e?p-=1<<e-g[M]++-1:++a}for(;a>=0&&p;--a){var E=o[a].s;g[E]==e&&(--g[E],++p)}w=e}return{t:new t(g),l:w}},x=function(t,n,r){return-1==t.s?Math.max(x(t.l,n,r+1),x(t.r,n,r+1)):n[t.s]=r},D=function(t){for(var r=t.length;r&&!t[--r];);for(var e=new n(++r),i=0,a=t[0],s=1,o=function(t){e[i++]=t},f=1;f<=r;++f)if(t[f]==a&&f!=r)++s;else{if(!a&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(a),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(a);s=1,a=t[f]}return{c:e.subarray(0,i),n:r}},T=function(t,n){for(var r=0,e=0;e<n.length;++e)r+=t[e]*n[e];return r},k=function(t,n,r){var e=r.length,i=m(n+2);t[i]=255&e,t[i+1]=e>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var a=0;a<e;++a)t[i+a+4]=r[a];return 8*(i+4+e)},C=function(t,r,s,o,f,h,l,u,c,v,m){z(r,m++,s),++f[256];for(var b=_(f,15),M=b.t,E=b.l,x=_(h,15),C=x.t,U=x.l,F=D(M),I=F.c,S=F.n,L=D(C),O=L.c,j=L.n,q=new n(19),B=0;B<I.length;++B)++q[31&I[B]];for(B=0;B<O.length;++B)++q[31&O[B]];for(var G=_(q,7),H=G.t,J=G.l,K=19;K>4&&!H[a[K-1]];--K);var N,P,Q,R,V=v+5<<3,W=T(f,g)+T(h,w)+l,X=T(f,M)+T(h,C)+l+14+3*K+T(q,H)+2*q[16]+3*q[17]+7*q[18];if(c>=0&&V<=W&&V<=X)return k(r,m,t.subarray(c,c+v));if(z(r,m,1+(X<W)),m+=2,X<W){N=d(M,E,0),P=M,Q=d(C,U,0),R=C;var Y=d(H,J,0);z(r,m,S-257),z(r,m+5,j-1),z(r,m+10,K-4),m+=14;for(B=0;B<K;++B)z(r,m+3*B,H[a[B]]);m+=3*K;for(var Z=[I,O],$=0;$<2;++$){var tt=Z[$];for(B=0;B<tt.length;++B){var nt=31&tt[B];z(r,m,Y[nt]),m+=H[nt],nt>15&&(z(r,m,tt[B]>>5&127),m+=tt[B]>>12)}}}else N=p,P=g,Q=y,R=w;for(B=0;B<u;++B){var rt=o[B];if(rt>255){A(r,m,N[(nt=rt>>18&31)+257]),m+=P[nt+257],nt>7&&(z(r,m,rt>>23&31),m+=e[nt]);var et=31&rt;A(r,m,Q[et]),m+=R[et],et>3&&(A(r,m,rt>>5&8191),m+=i[et])}else A(r,m,N[rt]),m+=P[rt]}return A(r,m,N[256]),m+P[256]},U=new r([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),F=new t(0),I=function(){for(var t=new Int32Array(256),n=0;n<256;++n){for(var r=n,e=9;--e;)r=(1&r&&-306674912)^r>>>1;t[n]=r}return t}(),S=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,a=0|r.length,s=0;s!=a;){for(var o=Math.min(s+2655,a);s<o;++s)i+=e+=r[s];e=(65535&e)+15*(e>>16),i=(65535&i)+15*(i>>16)}t=e,n=i},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(n%=65521))<<8|n>>8}}},L=function(a,s,o,f,u){if(!u&&(u={l:1},s.dictionary)){var c=s.dictionary.subarray(-32768),v=new t(c.length+a.length);v.set(c),v.set(a,c.length),a=v,u.w=c.length}return function(a,s,o,f,u,c){var v=c.z||a.length,d=new t(f+v+5*(1+Math.ceil(v/7e3))+u),g=d.subarray(f,d.length-u),w=c.l,p=7&(c.r||0);if(s){p&&(g[0]=c.r>>3);for(var y=U[s-1],M=y>>13,E=8191&y,z=(1<<o)-1,A=c.p||new n(32768),_=c.h||new n(z+1),x=Math.ceil(o/3),D=2*x,T=function(t){return(a[t]^a[t+1]<<x^a[t+2]<<D)&z},F=new r(25e3),I=new n(288),S=new n(32),L=0,O=0,j=c.i||0,q=0,B=c.w||0,G=0;j+2<v;++j){var H=T(j),J=32767&j,K=_[H];if(A[J]=K,_[H]=J,B<=j){var N=v-j;if((L>7e3||q>24576)&&(N>423||!w)){p=C(a,g,0,F,I,S,O,q,G,j-G,p),q=L=O=0,G=j;for(var P=0;P<286;++P)I[P]=0;for(P=0;P<30;++P)S[P]=0}var Q=2,R=0,V=E,W=J-K&32767;if(N>2&&H==T(j-W))for(var X=Math.min(M,N)-1,Y=Math.min(32767,j),Z=Math.min(258,N);W<=Y&&--V&&J!=K;){if(a[j+Q]==a[j+Q-W]){for(var $=0;$<Z&&a[j+$]==a[j+$-W];++$);if($>Q){if(Q=$,R=W,$>X)break;var tt=Math.min(W,$-2),nt=0;for(P=0;P<tt;++P){var rt=j-W+P&32767,et=rt-A[rt]&32767;et>nt&&(nt=et,K=rt)}}}W+=(J=K)-(K=A[J])&32767}if(R){F[q++]=268435456|h[Q]<<18|l[R];var it=31&h[Q],at=31&l[R];O+=e[it]+i[at],++I[257+it],++S[at],B=j+Q,++L}else F[q++]=a[j],++I[a[j]]}}for(j=Math.max(j,B);j<v;++j)F[q++]=a[j],++I[a[j]];p=C(a,g,w,F,I,S,O,q,G,j-G,p),w||(c.r=7&p|g[p/8|0]<<3,p-=7,c.h=_,c.p=A,c.i=j,c.w=B)}else{for(j=c.w||0;j<v+w;j+=65535){var st=j+65535;st>=v&&(g[p/8|0]=w,st=v),p=k(g,p+1,a.subarray(j,st))}c.i=v}return b(d,0,f+m(p)+u)}(a,null==s.level?6:s.level,null==s.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(a.length)))):12+s.mem,o,f,u)},O=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},j=function(){function n(n,r){if("function"==typeof n&&(r=n,n={}),this.ondata=r,this.o=n||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new t(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return n.prototype.p=function(t,n){this.ondata(L(t,this.o,0,0,this.s),n)},n.prototype.push=function(n,r){this.ondata||E(5),this.s.l&&E(4);var e=n.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new t(-32768&e);i.set(this.b.subarray(0,this.s.z)),this.b=i}var a=this.b.length-this.s.z;a&&(this.b.set(n.subarray(0,a),this.s.z),this.s.z=this.b.length,this.p(this.b,!1)),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(a),32768),this.s.z=n.length-a+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=1&r,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2)},n}();function q(t,n){n||(n={});var r=function(){var t=-1;return{p:function(n){for(var r=t,e=0;e<n.length;++e)r=I[255&r^n[e]]^r>>>8;t=r},d:function(){return~t}}}(),e=t.length;r.p(t);var i,a=L(t,n,10+((i=n).filename?i.filename.length+1:0),8),s=a.length;return function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&O(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}}(a,n),O(a,s-8,r.d()),O(a,s-4,e),a}var B=function(){function t(t,n){this.c=S(),this.v=1,j.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),j.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var r=L(t,this.o,this.v&&(this.o.dictionary?6:2),n&&4,this.s);this.v&&(function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;if(t[0]=120,t[1]=e<<6|(n.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,n.dictionary){var i=S();i.p(n.dictionary),O(t,2,i.d())}}(r,this.o),this.v=0),n&&O(r,r.length-4,this.c.d()),this.ondata(r,n)},t}(),G="undefined"!=typeof TextEncoder&&new TextEncoder,H="undefined"!=typeof TextDecoder&&new TextDecoder;try{H.decode(F,{stream:!0})}catch(t){}var J=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||E(5),this.d&&E(4),this.ondata(K(t),this.d=n||!1)},t}();function K(n,r){if(r){for(var e=new t(n.length),i=0;i<n.length;++i)e[i]=n.charCodeAt(i);return e}if(G)return G.encode(n);var a=n.length,s=new t(n.length+(n.length>>1)),o=0,f=function(t){s[o++]=t};for(i=0;i<a;++i){if(o+5>s.length){var h=new t(o+8+(a-i<<1));h.set(s),s=h}var l=n.charCodeAt(i);l<128||r?f(l):l<2048?(f(192|l>>6),f(128|63&l)):l>55295&&l<57344?(f(240|(l=65536+(1047552&l)|1023&n.charCodeAt(++i))>>18),f(128|l>>12&63),f(128|l>>6&63),f(128|63&l)):(f(224|l>>12),f(128|l>>6&63),f(128|63&l))}return b(s,0,o)}const N=new class{constructor(){this._init()}clear(){this._init()}addEvent(t){if(!t)throw new Error("Adding invalid event");const n=this._hasEvents?",":"";this.stream.push(n+t),this._hasEvents=!0}finish(){this.stream.push("]",!0);const t=function(t){let n=0;for(let r=0,e=t.length;r<e;r++)n+=t[r].length;const r=new Uint8Array(n);for(let n=0,e=0,i=t.length;n<i;n++){const i=t[n];r.set(i,e),e+=i.length}return r}(this._deflatedData);return this._init(),t}_init(){this._hasEvents=!1,this._deflatedData=[],this.deflate=new B,this.deflate.ondata=(t,n)=>{this._deflatedData.push(t)},this.stream=new J(((t,n)=>{this.deflate.push(t,n)})),this.stream.push("[")}},P={clear:()=>{N.clear()},addEvent:t=>N.addEvent(t),finish:()=>N.finish(),compress:t=>function(t){return q(K(t))}(t)};addEventListener("message",(function(t){const n=t.data.method,r=t.data.id,e=t.data.arg;if(n in P&&"function"==typeof P[n])try{const t=P[n](e);postMessage({id:r,method:n,success:!0,response:t})}catch(t){postMessage({id:r,method:n,success:!1,response:t.message}),console.error(t)}})),postMessage({id:void 0,method:"init",success:!0,response:void 0});`;
|
|
4675
4683
|
|
|
4676
4684
|
function e(){const e=new Blob([r]);return URL.createObjectURL(e)}
|
|
@@ -4679,7 +4687,7 @@ function e(){const e=new Blob([r]);return URL.createObjectURL(e)}
|
|
|
4679
4687
|
* Log a message in debug mode, and add a breadcrumb when _experiment.traceInternals is enabled.
|
|
4680
4688
|
*/
|
|
4681
4689
|
function logInfo(message, shouldAddBreadcrumb) {
|
|
4682
|
-
if (!
|
|
4690
|
+
if (!DEBUG_BUILD) {
|
|
4683
4691
|
return;
|
|
4684
4692
|
}
|
|
4685
4693
|
|
|
@@ -4695,7 +4703,7 @@ function logInfo(message, shouldAddBreadcrumb) {
|
|
|
4695
4703
|
* This is necessary when the breadcrumb may be added before the replay is initialized.
|
|
4696
4704
|
*/
|
|
4697
4705
|
function logInfoNextTick(message, shouldAddBreadcrumb) {
|
|
4698
|
-
if (!
|
|
4706
|
+
if (!DEBUG_BUILD) {
|
|
4699
4707
|
return;
|
|
4700
4708
|
}
|
|
4701
4709
|
|
|
@@ -4882,7 +4890,7 @@ class WorkerHandler {
|
|
|
4882
4890
|
|
|
4883
4891
|
if (!response.success) {
|
|
4884
4892
|
// TODO: Do some error handling, not sure what
|
|
4885
|
-
|
|
4893
|
+
DEBUG_BUILD && logger.error('[Replay]', response.response);
|
|
4886
4894
|
|
|
4887
4895
|
reject(new Error('Error in compression worker'));
|
|
4888
4896
|
return;
|
|
@@ -5112,7 +5120,7 @@ class EventBufferProxy {
|
|
|
5112
5120
|
try {
|
|
5113
5121
|
await Promise.all(addEventPromises);
|
|
5114
5122
|
} catch (error) {
|
|
5115
|
-
|
|
5123
|
+
DEBUG_BUILD && logger.warn('[Replay] Failed to add events when switching buffers.', error);
|
|
5116
5124
|
}
|
|
5117
5125
|
}
|
|
5118
5126
|
}
|
|
@@ -5467,10 +5475,10 @@ async function _addEvent(
|
|
|
5467
5475
|
} catch (error) {
|
|
5468
5476
|
const reason = error && error instanceof EventBufferSizeExceededError ? 'addEventSizeExceeded' : 'addEvent';
|
|
5469
5477
|
|
|
5470
|
-
|
|
5478
|
+
DEBUG_BUILD && logger.error(error);
|
|
5471
5479
|
await replay.stop({ reason });
|
|
5472
5480
|
|
|
5473
|
-
const client =
|
|
5481
|
+
const client = getClient();
|
|
5474
5482
|
|
|
5475
5483
|
if (client) {
|
|
5476
5484
|
client.recordDroppedEvent('internal_sdk_error', 'replay');
|
|
@@ -5515,7 +5523,7 @@ function maybeApplyCallback(
|
|
|
5515
5523
|
return callback(event);
|
|
5516
5524
|
}
|
|
5517
5525
|
} catch (error) {
|
|
5518
|
-
|
|
5526
|
+
DEBUG_BUILD &&
|
|
5519
5527
|
logger.error('[Replay] An error occured in the `beforeAddRecordingEvent` callback, skipping the event...', error);
|
|
5520
5528
|
return null;
|
|
5521
5529
|
}
|
|
@@ -5616,7 +5624,7 @@ function handleErrorEvent(replay, event) {
|
|
|
5616
5624
|
}
|
|
5617
5625
|
|
|
5618
5626
|
function isBaseTransportSend() {
|
|
5619
|
-
const client =
|
|
5627
|
+
const client = getClient();
|
|
5620
5628
|
if (!client) {
|
|
5621
5629
|
return false;
|
|
5622
5630
|
}
|
|
@@ -5747,7 +5755,7 @@ function handleGlobalEventListener(
|
|
|
5747
5755
|
// Unless `captureExceptions` is enabled, we want to ignore errors coming from rrweb
|
|
5748
5756
|
// As there can be a bunch of stuff going wrong in internals there, that we don't want to bubble up to users
|
|
5749
5757
|
if (isRrwebError(event, hint) && !replay.getOptions()._experiments.captureExceptions) {
|
|
5750
|
-
|
|
5758
|
+
DEBUG_BUILD && logger.log('[Replay] Ignoring error from rrweb internals', event);
|
|
5751
5759
|
return null;
|
|
5752
5760
|
}
|
|
5753
5761
|
|
|
@@ -5822,7 +5830,7 @@ function handleHistory(handlerData) {
|
|
|
5822
5830
|
}
|
|
5823
5831
|
|
|
5824
5832
|
/**
|
|
5825
|
-
* Returns a listener to be added to `
|
|
5833
|
+
* Returns a listener to be added to `addHistoryInstrumentationHandler(listener)`.
|
|
5826
5834
|
*/
|
|
5827
5835
|
function handleHistorySpanListener(replay) {
|
|
5828
5836
|
return (handlerData) => {
|
|
@@ -5854,7 +5862,7 @@ function handleHistorySpanListener(replay) {
|
|
|
5854
5862
|
*/
|
|
5855
5863
|
function shouldFilterRequest(replay, url) {
|
|
5856
5864
|
// If we enabled the `traceInternals` experiment, we want to trace everything
|
|
5857
|
-
if (
|
|
5865
|
+
if (DEBUG_BUILD && replay.getOptions()._experiments.traceInternals) {
|
|
5858
5866
|
return false;
|
|
5859
5867
|
}
|
|
5860
5868
|
|
|
@@ -5911,7 +5919,7 @@ function handleFetch(handlerData) {
|
|
|
5911
5919
|
}
|
|
5912
5920
|
|
|
5913
5921
|
/**
|
|
5914
|
-
* Returns a listener to be added to `
|
|
5922
|
+
* Returns a listener to be added to `addFetchInstrumentationHandler(listener)`.
|
|
5915
5923
|
*/
|
|
5916
5924
|
function handleFetchSpanListener(replay) {
|
|
5917
5925
|
return (handlerData) => {
|
|
@@ -5955,7 +5963,7 @@ function handleXhr(handlerData) {
|
|
|
5955
5963
|
}
|
|
5956
5964
|
|
|
5957
5965
|
/**
|
|
5958
|
-
* Returns a listener to be added to `
|
|
5966
|
+
* Returns a listener to be added to `addXhrInstrumentationHandler(listener)`.
|
|
5959
5967
|
*/
|
|
5960
5968
|
function handleXhrSpanListener(replay) {
|
|
5961
5969
|
return (handlerData) => {
|
|
@@ -6022,23 +6030,47 @@ function parseContentLengthHeader(header) {
|
|
|
6022
6030
|
function getBodyString(body) {
|
|
6023
6031
|
try {
|
|
6024
6032
|
if (typeof body === 'string') {
|
|
6025
|
-
return body;
|
|
6033
|
+
return [body];
|
|
6026
6034
|
}
|
|
6027
6035
|
|
|
6028
6036
|
if (body instanceof URLSearchParams) {
|
|
6029
|
-
return body.toString();
|
|
6037
|
+
return [body.toString()];
|
|
6030
6038
|
}
|
|
6031
6039
|
|
|
6032
6040
|
if (body instanceof FormData) {
|
|
6033
|
-
return _serializeFormData(body);
|
|
6041
|
+
return [_serializeFormData(body)];
|
|
6034
6042
|
}
|
|
6035
6043
|
} catch (e2) {
|
|
6036
|
-
|
|
6044
|
+
DEBUG_BUILD && logger.warn('[Replay] Failed to serialize body', body);
|
|
6045
|
+
return [undefined, 'BODY_PARSE_ERROR'];
|
|
6037
6046
|
}
|
|
6038
6047
|
|
|
6039
|
-
|
|
6048
|
+
DEBUG_BUILD && logger.info('[Replay] Skipping network body because of body type', body);
|
|
6040
6049
|
|
|
6041
|
-
return undefined;
|
|
6050
|
+
return [undefined];
|
|
6051
|
+
}
|
|
6052
|
+
|
|
6053
|
+
/** Merge a warning into an existing network request/response. */
|
|
6054
|
+
function mergeWarning(
|
|
6055
|
+
info,
|
|
6056
|
+
warning,
|
|
6057
|
+
) {
|
|
6058
|
+
if (!info) {
|
|
6059
|
+
return {
|
|
6060
|
+
headers: {},
|
|
6061
|
+
size: undefined,
|
|
6062
|
+
_meta: {
|
|
6063
|
+
warnings: [warning],
|
|
6064
|
+
},
|
|
6065
|
+
};
|
|
6066
|
+
}
|
|
6067
|
+
|
|
6068
|
+
const newMeta = { ...info._meta };
|
|
6069
|
+
const existingWarnings = newMeta.warnings || [];
|
|
6070
|
+
newMeta.warnings = [...existingWarnings, warning];
|
|
6071
|
+
|
|
6072
|
+
info._meta = newMeta;
|
|
6073
|
+
return info;
|
|
6042
6074
|
}
|
|
6043
6075
|
|
|
6044
6076
|
/** Convert ReplayNetworkRequestData to a PerformanceEntry. */
|
|
@@ -6171,7 +6203,7 @@ function normalizeNetworkBody(body)
|
|
|
6171
6203
|
return {
|
|
6172
6204
|
body: jsonBody,
|
|
6173
6205
|
};
|
|
6174
|
-
} catch (
|
|
6206
|
+
} catch (e3) {
|
|
6175
6207
|
// fall back to just send the body as string
|
|
6176
6208
|
}
|
|
6177
6209
|
}
|
|
@@ -6237,7 +6269,7 @@ async function captureFetchBreadcrumbToReplay(
|
|
|
6237
6269
|
const result = makeNetworkReplayBreadcrumb('resource.fetch', data);
|
|
6238
6270
|
addNetworkBreadcrumb(options.replay, result);
|
|
6239
6271
|
} catch (error) {
|
|
6240
|
-
|
|
6272
|
+
DEBUG_BUILD && logger.error('[Replay] Failed to capture fetch breadcrumb', error);
|
|
6241
6273
|
}
|
|
6242
6274
|
}
|
|
6243
6275
|
|
|
@@ -6316,10 +6348,17 @@ function _getRequestInfo(
|
|
|
6316
6348
|
|
|
6317
6349
|
// We only want to transmit string or string-like bodies
|
|
6318
6350
|
const requestBody = _getFetchRequestArgBody(input);
|
|
6319
|
-
const bodyStr = getBodyString(requestBody);
|
|
6320
|
-
|
|
6351
|
+
const [bodyStr, warning] = getBodyString(requestBody);
|
|
6352
|
+
const data = buildNetworkRequestOrResponse(headers, requestBodySize, bodyStr);
|
|
6353
|
+
|
|
6354
|
+
if (warning) {
|
|
6355
|
+
return mergeWarning(data, warning);
|
|
6356
|
+
}
|
|
6357
|
+
|
|
6358
|
+
return data;
|
|
6321
6359
|
}
|
|
6322
6360
|
|
|
6361
|
+
/** Exported only for tests. */
|
|
6323
6362
|
async function _getResponseInfo(
|
|
6324
6363
|
captureDetails,
|
|
6325
6364
|
{
|
|
@@ -6342,12 +6381,35 @@ async function _getResponseInfo(
|
|
|
6342
6381
|
return buildNetworkRequestOrResponse(headers, responseBodySize, undefined);
|
|
6343
6382
|
}
|
|
6344
6383
|
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6384
|
+
const [bodyText, warning] = await _parseFetchResponseBody(response);
|
|
6385
|
+
const result = getResponseData(bodyText, {
|
|
6386
|
+
networkCaptureBodies,
|
|
6387
|
+
textEncoder,
|
|
6388
|
+
responseBodySize,
|
|
6389
|
+
captureDetails,
|
|
6390
|
+
headers,
|
|
6391
|
+
});
|
|
6392
|
+
|
|
6393
|
+
if (warning) {
|
|
6394
|
+
return mergeWarning(result, warning);
|
|
6395
|
+
}
|
|
6350
6396
|
|
|
6397
|
+
return result;
|
|
6398
|
+
}
|
|
6399
|
+
|
|
6400
|
+
function getResponseData(
|
|
6401
|
+
bodyText,
|
|
6402
|
+
{
|
|
6403
|
+
networkCaptureBodies,
|
|
6404
|
+
textEncoder,
|
|
6405
|
+
responseBodySize,
|
|
6406
|
+
captureDetails,
|
|
6407
|
+
headers,
|
|
6408
|
+
}
|
|
6409
|
+
|
|
6410
|
+
,
|
|
6411
|
+
) {
|
|
6412
|
+
try {
|
|
6351
6413
|
const size =
|
|
6352
6414
|
bodyText && bodyText.length && responseBodySize === undefined
|
|
6353
6415
|
? getBodySize(bodyText, textEncoder)
|
|
@@ -6363,17 +6425,25 @@ async function _getResponseInfo(
|
|
|
6363
6425
|
|
|
6364
6426
|
return buildNetworkRequestOrResponse(headers, size, undefined);
|
|
6365
6427
|
} catch (error) {
|
|
6366
|
-
|
|
6428
|
+
DEBUG_BUILD && logger.warn('[Replay] Failed to serialize response body', error);
|
|
6367
6429
|
// fallback
|
|
6368
6430
|
return buildNetworkRequestOrResponse(headers, responseBodySize, undefined);
|
|
6369
6431
|
}
|
|
6370
6432
|
}
|
|
6371
6433
|
|
|
6372
|
-
async function
|
|
6434
|
+
async function _parseFetchResponseBody(response) {
|
|
6435
|
+
const res = _tryCloneResponse(response);
|
|
6436
|
+
|
|
6437
|
+
if (!res) {
|
|
6438
|
+
return [undefined, 'BODY_PARSE_ERROR'];
|
|
6439
|
+
}
|
|
6440
|
+
|
|
6373
6441
|
try {
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6442
|
+
const text = await _tryGetResponseText(res);
|
|
6443
|
+
return [text];
|
|
6444
|
+
} catch (error) {
|
|
6445
|
+
DEBUG_BUILD && logger.warn('[Replay] Failed to get text body from response', error);
|
|
6446
|
+
return [undefined, 'BODY_PARSE_ERROR'];
|
|
6377
6447
|
}
|
|
6378
6448
|
}
|
|
6379
6449
|
|
|
@@ -6436,6 +6506,40 @@ function getHeadersFromOptions(
|
|
|
6436
6506
|
return getAllowedHeaders(headers, allowedHeaders);
|
|
6437
6507
|
}
|
|
6438
6508
|
|
|
6509
|
+
function _tryCloneResponse(response) {
|
|
6510
|
+
try {
|
|
6511
|
+
// We have to clone this, as the body can only be read once
|
|
6512
|
+
return response.clone();
|
|
6513
|
+
} catch (error) {
|
|
6514
|
+
// this can throw if the response was already consumed before
|
|
6515
|
+
DEBUG_BUILD && logger.warn('[Replay] Failed to clone response body', error);
|
|
6516
|
+
}
|
|
6517
|
+
}
|
|
6518
|
+
|
|
6519
|
+
/**
|
|
6520
|
+
* Get the response body of a fetch request, or timeout after 500ms.
|
|
6521
|
+
* Fetch can return a streaming body, that may not resolve (or not for a long time).
|
|
6522
|
+
* If that happens, we rather abort after a short time than keep waiting for this.
|
|
6523
|
+
*/
|
|
6524
|
+
function _tryGetResponseText(response) {
|
|
6525
|
+
return new Promise((resolve, reject) => {
|
|
6526
|
+
const timeout = setTimeout(() => reject(new Error('Timeout while trying to read response body')), 500);
|
|
6527
|
+
|
|
6528
|
+
_getResponseText(response)
|
|
6529
|
+
.then(
|
|
6530
|
+
txt => resolve(txt),
|
|
6531
|
+
reason => reject(reason),
|
|
6532
|
+
)
|
|
6533
|
+
.finally(() => clearTimeout(timeout));
|
|
6534
|
+
});
|
|
6535
|
+
}
|
|
6536
|
+
|
|
6537
|
+
async function _getResponseText(response) {
|
|
6538
|
+
// Force this to be a promise, just to be safe
|
|
6539
|
+
// eslint-disable-next-line no-return-await
|
|
6540
|
+
return await response.text();
|
|
6541
|
+
}
|
|
6542
|
+
|
|
6439
6543
|
/**
|
|
6440
6544
|
* Capture an XHR breadcrumb to a replay.
|
|
6441
6545
|
* This adds additional data (where approriate).
|
|
@@ -6452,7 +6556,7 @@ async function captureXhrBreadcrumbToReplay(
|
|
|
6452
6556
|
const result = makeNetworkReplayBreadcrumb('resource.xhr', data);
|
|
6453
6557
|
addNetworkBreadcrumb(options.replay, result);
|
|
6454
6558
|
} catch (error) {
|
|
6455
|
-
|
|
6559
|
+
DEBUG_BUILD && logger.error('[Replay] Failed to capture xhr breadcrumb', error);
|
|
6456
6560
|
}
|
|
6457
6561
|
}
|
|
6458
6562
|
|
|
@@ -6525,8 +6629,8 @@ function _prepareXhrData(
|
|
|
6525
6629
|
: {};
|
|
6526
6630
|
const networkResponseHeaders = getAllowedHeaders(getResponseHeaders(xhr), options.networkResponseHeaders);
|
|
6527
6631
|
|
|
6528
|
-
const requestBody = options.networkCaptureBodies ? getBodyString(input) : undefined;
|
|
6529
|
-
const responseBody = options.networkCaptureBodies ? _getXhrResponseBody(xhr) : undefined;
|
|
6632
|
+
const [requestBody, requestWarning] = options.networkCaptureBodies ? getBodyString(input) : [undefined];
|
|
6633
|
+
const [responseBody, responseWarning] = options.networkCaptureBodies ? _getXhrResponseBody(xhr) : [undefined];
|
|
6530
6634
|
|
|
6531
6635
|
const request = buildNetworkRequestOrResponse(networkRequestHeaders, requestBodySize, requestBody);
|
|
6532
6636
|
const response = buildNetworkRequestOrResponse(networkResponseHeaders, responseBodySize, responseBody);
|
|
@@ -6537,8 +6641,8 @@ function _prepareXhrData(
|
|
|
6537
6641
|
url,
|
|
6538
6642
|
method,
|
|
6539
6643
|
statusCode,
|
|
6540
|
-
request,
|
|
6541
|
-
response,
|
|
6644
|
+
request: requestWarning ? mergeWarning(request, requestWarning) : request,
|
|
6645
|
+
response: responseWarning ? mergeWarning(response, responseWarning) : response,
|
|
6542
6646
|
};
|
|
6543
6647
|
}
|
|
6544
6648
|
|
|
@@ -6561,7 +6665,7 @@ function _getXhrResponseBody(xhr) {
|
|
|
6561
6665
|
const errors = [];
|
|
6562
6666
|
|
|
6563
6667
|
try {
|
|
6564
|
-
return xhr.responseText;
|
|
6668
|
+
return [xhr.responseText];
|
|
6565
6669
|
} catch (e) {
|
|
6566
6670
|
errors.push(e);
|
|
6567
6671
|
}
|
|
@@ -6574,9 +6678,9 @@ function _getXhrResponseBody(xhr) {
|
|
|
6574
6678
|
errors.push(e);
|
|
6575
6679
|
}
|
|
6576
6680
|
|
|
6577
|
-
|
|
6681
|
+
DEBUG_BUILD && logger.warn('[Replay] Failed to get xhr response body', ...errors);
|
|
6578
6682
|
|
|
6579
|
-
return undefined;
|
|
6683
|
+
return [undefined];
|
|
6580
6684
|
}
|
|
6581
6685
|
|
|
6582
6686
|
/**
|
|
@@ -6586,7 +6690,7 @@ function _getXhrResponseBody(xhr) {
|
|
|
6586
6690
|
* (enriching it with further data that is _not_ added to the regular breadcrumbs)
|
|
6587
6691
|
*/
|
|
6588
6692
|
function handleNetworkBreadcrumbs(replay) {
|
|
6589
|
-
const client =
|
|
6693
|
+
const client = getClient();
|
|
6590
6694
|
|
|
6591
6695
|
try {
|
|
6592
6696
|
const textEncoder = new TextEncoder();
|
|
@@ -6613,8 +6717,8 @@ function handleNetworkBreadcrumbs(replay) {
|
|
|
6613
6717
|
client.on('beforeAddBreadcrumb', (breadcrumb, hint) => beforeAddNetworkBreadcrumb(options, breadcrumb, hint));
|
|
6614
6718
|
} else {
|
|
6615
6719
|
// Fallback behavior
|
|
6616
|
-
|
|
6617
|
-
|
|
6720
|
+
addFetchInstrumentationHandler(handleFetchSpanListener(replay));
|
|
6721
|
+
addXhrInstrumentationHandler(handleXhrSpanListener(replay));
|
|
6618
6722
|
}
|
|
6619
6723
|
} catch (e2) {
|
|
6620
6724
|
// Do nothing
|
|
@@ -6650,7 +6754,7 @@ function beforeAddNetworkBreadcrumb(
|
|
|
6650
6754
|
void captureFetchBreadcrumbToReplay(breadcrumb, hint, options);
|
|
6651
6755
|
}
|
|
6652
6756
|
} catch (e) {
|
|
6653
|
-
|
|
6757
|
+
DEBUG_BUILD && logger.warn('Error when enriching network breadcrumb');
|
|
6654
6758
|
}
|
|
6655
6759
|
}
|
|
6656
6760
|
|
|
@@ -6784,11 +6888,11 @@ function normalizeConsoleBreadcrumb(
|
|
|
6784
6888
|
function addGlobalListeners(replay) {
|
|
6785
6889
|
// Listeners from core SDK //
|
|
6786
6890
|
const scope = getCurrentHub().getScope();
|
|
6787
|
-
const client =
|
|
6891
|
+
const client = getClient();
|
|
6788
6892
|
|
|
6789
6893
|
scope.addScopeListener(handleScopeListener(replay));
|
|
6790
|
-
|
|
6791
|
-
|
|
6894
|
+
addClickKeypressInstrumentationHandler(handleDomListener(replay));
|
|
6895
|
+
addHistoryInstrumentationHandler(handleHistorySpanListener(replay));
|
|
6792
6896
|
handleNetworkBreadcrumbs(replay);
|
|
6793
6897
|
|
|
6794
6898
|
// Tag all (non replay) events that get sent to Sentry with the current
|
|
@@ -6956,7 +7060,7 @@ function getHandleRecordingEmit(replay) {
|
|
|
6956
7060
|
return (event, _isCheckout) => {
|
|
6957
7061
|
// If this is false, it means session is expired, create and a new session and wait for checkout
|
|
6958
7062
|
if (!replay.checkAndHandleExpiredSession()) {
|
|
6959
|
-
|
|
7063
|
+
DEBUG_BUILD && logger.warn('[Replay] Received replay event after session expired.');
|
|
6960
7064
|
|
|
6961
7065
|
return;
|
|
6962
7066
|
}
|
|
@@ -7373,7 +7477,7 @@ async function sendReplay(
|
|
|
7373
7477
|
_retryCount: retryConfig.count,
|
|
7374
7478
|
});
|
|
7375
7479
|
|
|
7376
|
-
if (
|
|
7480
|
+
if (DEBUG_BUILD && options._experiments && options._experiments.captureExceptions) {
|
|
7377
7481
|
captureException(err);
|
|
7378
7482
|
}
|
|
7379
7483
|
|
|
@@ -8105,9 +8209,9 @@ class ReplayContainer {
|
|
|
8105
8209
|
|
|
8106
8210
|
/** A wrapper to conditionally capture exceptions. */
|
|
8107
8211
|
_handleException(error) {
|
|
8108
|
-
|
|
8212
|
+
DEBUG_BUILD && logger.error('[Replay]', error);
|
|
8109
8213
|
|
|
8110
|
-
if (
|
|
8214
|
+
if (DEBUG_BUILD && this._options._experiments && this._options._experiments.captureExceptions) {
|
|
8111
8215
|
captureException(error);
|
|
8112
8216
|
}
|
|
8113
8217
|
}
|
|
@@ -8424,7 +8528,7 @@ class ReplayContainer {
|
|
|
8424
8528
|
const replayId = this.getSessionId();
|
|
8425
8529
|
|
|
8426
8530
|
if (!this.session || !this.eventBuffer || !replayId) {
|
|
8427
|
-
|
|
8531
|
+
DEBUG_BUILD && logger.error('[Replay] No session or eventBuffer found to flush.');
|
|
8428
8532
|
return;
|
|
8429
8533
|
}
|
|
8430
8534
|
|
|
@@ -8486,7 +8590,7 @@ class ReplayContainer {
|
|
|
8486
8590
|
// In this case, we want to completely stop the replay - otherwise, we may get inconsistent segments
|
|
8487
8591
|
void this.stop({ reason: 'sendReplay' });
|
|
8488
8592
|
|
|
8489
|
-
const client =
|
|
8593
|
+
const client = getClient();
|
|
8490
8594
|
|
|
8491
8595
|
if (client) {
|
|
8492
8596
|
client.recordDroppedEvent('send_error', 'replay');
|
|
@@ -8509,7 +8613,7 @@ class ReplayContainer {
|
|
|
8509
8613
|
}
|
|
8510
8614
|
|
|
8511
8615
|
if (!this.checkAndHandleExpiredSession()) {
|
|
8512
|
-
|
|
8616
|
+
DEBUG_BUILD && logger.error('[Replay] Attempting to finish replay event after session expired.');
|
|
8513
8617
|
return;
|
|
8514
8618
|
}
|
|
8515
8619
|
|
|
@@ -8567,7 +8671,7 @@ class ReplayContainer {
|
|
|
8567
8671
|
try {
|
|
8568
8672
|
await this._flushLock;
|
|
8569
8673
|
} catch (err) {
|
|
8570
|
-
|
|
8674
|
+
DEBUG_BUILD && logger.error(err);
|
|
8571
8675
|
} finally {
|
|
8572
8676
|
this._debouncedFlush();
|
|
8573
8677
|
}
|
|
@@ -8636,10 +8740,12 @@ function getOption(
|
|
|
8636
8740
|
allSelectors.push(`.${deprecatedClassOption}`);
|
|
8637
8741
|
}
|
|
8638
8742
|
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8743
|
+
consoleSandbox(() => {
|
|
8744
|
+
// eslint-disable-next-line no-console
|
|
8745
|
+
console.warn(
|
|
8746
|
+
'[Replay] You are using a deprecated configuration item for privacy. Read the documentation on how to use the new privacy configuration.',
|
|
8747
|
+
);
|
|
8748
|
+
});
|
|
8643
8749
|
}
|
|
8644
8750
|
|
|
8645
8751
|
return allSelectors.join(',');
|
|
@@ -9051,14 +9157,16 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
|
|
|
9051
9157
|
|
|
9052
9158
|
/** Parse Replay-related options from SDK options */
|
|
9053
9159
|
function loadReplayOptionsFromClient(initialOptions) {
|
|
9054
|
-
const client =
|
|
9160
|
+
const client = getClient();
|
|
9055
9161
|
const opt = client && (client.getOptions() );
|
|
9056
9162
|
|
|
9057
9163
|
const finalOptions = { sessionSampleRate: 0, errorSampleRate: 0, ...dropUndefinedKeys(initialOptions) };
|
|
9058
9164
|
|
|
9059
9165
|
if (!opt) {
|
|
9060
|
-
|
|
9061
|
-
|
|
9166
|
+
consoleSandbox(() => {
|
|
9167
|
+
// eslint-disable-next-line no-console
|
|
9168
|
+
console.warn('SDK client is not available.');
|
|
9169
|
+
});
|
|
9062
9170
|
return finalOptions;
|
|
9063
9171
|
}
|
|
9064
9172
|
|
|
@@ -9068,10 +9176,12 @@ function loadReplayOptionsFromClient(initialOptions) {
|
|
|
9068
9176
|
opt.replaysSessionSampleRate == null &&
|
|
9069
9177
|
opt.replaysOnErrorSampleRate == null
|
|
9070
9178
|
) {
|
|
9071
|
-
|
|
9072
|
-
|
|
9073
|
-
|
|
9074
|
-
|
|
9179
|
+
consoleSandbox(() => {
|
|
9180
|
+
// eslint-disable-next-line no-console
|
|
9181
|
+
console.warn(
|
|
9182
|
+
'Replay is disabled because neither `replaysSessionSampleRate` nor `replaysOnErrorSampleRate` are set.',
|
|
9183
|
+
);
|
|
9184
|
+
});
|
|
9075
9185
|
}
|
|
9076
9186
|
|
|
9077
9187
|
if (typeof opt.replaysSessionSampleRate === 'number') {
|