diff --git a/.changeset/stale-jobs-give.md b/.changeset/stale-jobs-give.md new file mode 100644 index 00000000..fa4b218c --- /dev/null +++ b/.changeset/stale-jobs-give.md @@ -0,0 +1,5 @@ +--- +'@spotlightjs/overlay': patch +--- + +Fix stacktraces are not reversed sometimes (appearing in wrong order) diff --git a/packages/overlay/src/integrations/sentry/data/sentryDataCache.ts b/packages/overlay/src/integrations/sentry/data/sentryDataCache.ts index 11ccf5ad..f2f7d42a 100644 --- a/packages/overlay/src/integrations/sentry/data/sentryDataCache.ts +++ b/packages/overlay/src/integrations/sentry/data/sentryDataCache.ts @@ -286,14 +286,17 @@ class SentryDataCache { return Promise.all( (errorEvent.exception.values ?? []).map(async exception => { + if (!exception.stacktrace) { + return; + } + exception.stacktrace.frames.reverse(); + if ( - !exception.stacktrace || exception.stacktrace.frames?.every(frame => frame.post_context && frame.pre_context && frame.context_line) ) { - log('Skipping contextlines request for', exception); + log('Skipping contextlines request as we have full context for', exception); return; } - exception.stacktrace.frames.reverse(); try { const makeFetch = getNativeFetchImplementation();