From 9ef4ac5e238dd8d7d4d02266f9f4d9ac79b423c2 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Thu, 1 Oct 2026 14:46:29 +0200 Subject: [PATCH 1/2] fix(spotlight): Forward image attachments to Spotlight The Spotlight integration stripped image content-type items from the envelope before forwarding it to the sidecar, as a workaround for the sidecar not supporting images at the time (#3550, Jan 2024). Spotlight has supported image attachment display since overlay 4.5.0, and the upstream `@sentry/browser` integration forwards envelopes unmodified. Stop stripping images so screenshots and replay frames reach Spotlight. Co-Authored-By: Claude Opus 4.8 --- CHANGELOG.md | 6 ++++++ packages/core/src/js/integrations/spotlight.ts | 12 ++---------- packages/core/test/integrations/spotlight.test.ts | 4 ++-- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7fec7c654..71bd4511d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ > make sure you follow our [migration guide](https://docs.sentry.io/platforms/react-native/migration/) first. +## Unreleased + +### Fixes + +- Forward image attachments (e.g. screenshots and replay frames) to Spotlight instead of stripping them from the envelope ([#6818](https://github.com/getsentry/sentry-react-native/pull/6818)) + ## 8.29.0 ### Features diff --git a/packages/core/src/js/integrations/spotlight.ts b/packages/core/src/js/integrations/spotlight.ts index 9a09a4340c..9c8d213c3a 100644 --- a/packages/core/src/js/integrations/spotlight.ts +++ b/packages/core/src/js/integrations/spotlight.ts @@ -47,15 +47,7 @@ function sendEnvelopesToSidecar(client: Client, sidecarUrl: string): void { return; } - client.on('beforeEnvelope', (originalEnvelope: Envelope) => { - // TODO: This is a workaround for spotlight/sidecar not supporting images - const spotlightEnvelope: Envelope = [...originalEnvelope]; - const envelopeItems = [...originalEnvelope[1]].filter( - item => typeof item[0].content_type !== 'string' || !item[0].content_type.startsWith('image'), - ); - - spotlightEnvelope[1] = envelopeItems as Envelope[1]; - + client.on('beforeEnvelope', (envelope: Envelope) => { const xhr = createStealthXhr(); if (!xhr) { debug.error('[Spotlight] Sentry SDK can not create XHR object'); @@ -80,7 +72,7 @@ function sendEnvelopesToSidecar(client: Client, sidecarUrl: string): void { } }; - xhr.send(serializeEnvelope(spotlightEnvelope)); + xhr.send(serializeEnvelope(envelope)); }); } diff --git a/packages/core/test/integrations/spotlight.test.ts b/packages/core/test/integrations/spotlight.test.ts index 8bcef972ad..7f712ef453 100644 --- a/packages/core/test/integrations/spotlight.test.ts +++ b/packages/core/test/integrations/spotlight.test.ts @@ -35,7 +35,7 @@ describe('spotlight', () => { expect(originalEnvelopeReference).toEqual(createMockEnvelope()); }); - it('should remove image attachments from spotlight envelope', async () => { + it('should forward image attachments to spotlight', async () => { const mockClient = createMockClient(); const spotlight = spotlightIntegration(); @@ -47,7 +47,7 @@ describe('spotlight', () => { const [{ request }] = requestListener.mock.calls[0]; expect(spotlightBeforeEnvelope).toBeDefined(); - expect((await request.text()).includes('image/png')).toBe(false); + expect((await request.text()).includes('image/png')).toBe(true); }); }); From 6ae3fcce3fc0472bd1778684b6ca025a00e07028 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Thu, 1 Oct 2026 14:47:59 +0200 Subject: [PATCH 2/2] Simplify changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71bd4511d1..e08fad28ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ ### Fixes -- Forward image attachments (e.g. screenshots and replay frames) to Spotlight instead of stripping them from the envelope ([#6818](https://github.com/getsentry/sentry-react-native/pull/6818)) +- Forward image attachments to Spotlight instead of stripping them from the envelope ([#6818](https://github.com/getsentry/sentry-react-native/pull/6818)) ## 8.29.0