Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
12 changes: 2 additions & 10 deletions packages/core/src/js/integrations/spotlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -80,7 +72,7 @@ function sendEnvelopesToSidecar(client: Client, sidecarUrl: string): void {
}
};

xhr.send(serializeEnvelope(spotlightEnvelope));
xhr.send(serializeEnvelope(envelope));
});
}

Expand Down
4 changes: 2 additions & 2 deletions packages/core/test/integrations/spotlight.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
});
});

Expand Down
Loading