diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fe0a960f9..7a68490167 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ ### Fixes +- Forward image attachments to Spotlight instead of stripping them from the envelope ([#6818](https://github.com/getsentry/sentry-react-native/pull/6818)) - Don't crash the iOS app when Sentry is initialized with an invalid DSN ([#6825](https://github.com/getsentry/sentry-react-native/pull/6825)) - Populate the Hermes runtime version on JS profiles instead of sending an empty value ([#6817](https://github.com/getsentry/sentry-react-native/pull/6817)) 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); }); });