From 8e8186ad188b2ba9af8eafd77c66b423c3512c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20Wold=C5=99ich?= <31292499+krystofwoldrich@users.noreply.github.com> Date: Mon, 26 Feb 2024 13:07:15 +0100 Subject: [PATCH] fix(symbolication): Ignore dev server JSON responses (#3611) --- CHANGELOG.md | 1 + src/js/integrations/debugsymbolicator.ts | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9d0b312fd..9696bf73be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ### Fixes - Option `enabled: false` ensures no events are sent ([#3606](https://github.com/getsentry/sentry-react-native/pull/3606)) +- Ignore JSON response when retrieving source context from local Expo Dev Server ([#3611](https://github.com/getsentry/sentry-react-native/pull/3611)) ### Dependencies diff --git a/src/js/integrations/debugsymbolicator.ts b/src/js/integrations/debugsymbolicator.ts index 4ab109f4fe..1174c79053 100644 --- a/src/js/integrations/debugsymbolicator.ts +++ b/src/js/integrations/debugsymbolicator.ts @@ -219,7 +219,17 @@ export class DebugSymbolicator implements Integration { if (xhr.status !== 200) { resolve(null); } - resolve(xhr.responseText); + const response = xhr.responseText; + if ( + typeof response !== 'string' || + // Expo Dev Server responses with status 200 and config JSON + // when web support not enabled and requested file not found + response.startsWith('{') + ) { + resolve(null); + } + + resolve(response); } }; xhr.onerror = (): void => {