File tree Expand file tree Collapse file tree 4 files changed +17
-7
lines changed
Expand file tree Collapse file tree 4 files changed +17
-7
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @spotlightjs/overlay ' : patch
3+ ---
4+
5+ Fix direct transport init when sidecar transport is already enabled
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ export async function init(options: SpotlightOverlayOptions = {}) {
138138 const finalExperiments = { ...DEFAULT_EXPERIMENTS , ...experiments } ;
139139
140140 // Sentry is enabled by default
141- const defaultIntegrations = ( ) => [ sentry ( { injectIntoSDK : ! isLoadedFromSidecar } ) ] ;
141+ const defaultIntegrations = ( ) => [ sentry ( { injectIntoSDK : ! isLoadedFromSidecar && ! fullPage } ) ] ;
142142
143143 const context : SpotlightContext = {
144144 open : openSpotlight ,
Original file line number Diff line number Diff line change @@ -118,11 +118,6 @@ function parseJSONFromBuffer(data: Uint8Array): object {
118118 * @returns parsed envelope
119119 */
120120export function processEnvelope ( rawEvent : RawEventContext ) {
121- // Use this weird way of converting to Uint8Array as we use SSE
122- // which always uses utf-8 encoding but we can have envelopes with
123- // binary data such as screenshots or videos.
124- // Ideally we'd use base64 encoding for binary data but that requires
125- // a breaking change in the sidecar so skipping that for now.
126121 let buffer =
127122 typeof rawEvent . data === 'string'
128123 ? Uint8Array . from ( Array . from ( rawEvent . data , c => c . charCodeAt ( 0 ) ) )
@@ -243,8 +238,18 @@ function addSpotlightIntegrationToSentry(options: SentryIntegrationOptions) {
243238 sentryClient . _dsn = undefined ;
244239 // @ts -ignore
245240 sentryClient . _options . tracesSampler = ( ) => 1 ;
241+ // @ts -ignore
242+ sentryClient . _options . sampleRate = 1 ;
246243
247244 try {
245+ // @ts -expect-error ts(2339) -- We're accessing a private property here
246+ const existingIntegration = Object . keys ( sentryClient . _integrations ) . find ( i => / s p o t l i g h t / i. test ( i ) ) ;
247+ if ( existingIntegration ) {
248+ log (
249+ `Skipping direct integration as there's already a Spotlight integration enabled in Sentry SDK: ${ existingIntegration } ` ,
250+ ) ;
251+ return ;
252+ }
248253 const integration = spotlightIntegration ( ) ;
249254 sentryClient . addIntegration ( integration ) ;
250255 } catch ( e ) {
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import sentryDataCache from './data/sentryDataCache';
1616 */
1717export const spotlightIntegration = ( ) => {
1818 return {
19- name : 'SpotlightBrowser ' ,
19+ name : 'SpotlightBrowserDirect ' ,
2020 setupOnce : ( ) => {
2121 /* Empty function to ensure compatibility w/ JS SDK v7 >= 7.99.0 */
2222 } ,
You can’t perform that action at this time.
0 commit comments