Skip to content

Commit 2d9e8b0

Browse files
authored
Merge branch 'main' into alwx/experiment/eas-build
2 parents b539460 + 7de3fdc commit 2d9e8b0

16 files changed

+484
-110
lines changed

.github/workflows/buildandtest.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,24 +144,24 @@ jobs:
144144
- name: Build
145145
run: yarn build
146146
- name: Archive dist
147-
uses: actions/upload-artifact@v6
147+
uses: actions/upload-artifact@v7
148148
with:
149149
name: dist
150150
path: packages/core/dist
151151
- name: Archive ts3.8
152-
uses: actions/upload-artifact@v6
152+
uses: actions/upload-artifact@v7
153153
with:
154154
name: ts3.8
155155
path: packages/core/ts3.8
156156
- name: Archive Expo Plugin
157-
uses: actions/upload-artifact@v6
157+
uses: actions/upload-artifact@v7
158158
with:
159159
name: expo-plugin
160160
path: packages/core/plugin/build
161161
- name: Pack
162162
run: yarn build:tarball
163163
- name: Archive Artifacts
164-
uses: actions/upload-artifact@v6
164+
uses: actions/upload-artifact@v7
165165
with:
166166
name: ${{ github.sha }}
167167
path: |
@@ -186,12 +186,12 @@ jobs:
186186
- name: Install Dependencies
187187
run: yarn install
188188
- name: Download dist
189-
uses: actions/download-artifact@v7
189+
uses: actions/download-artifact@v8
190190
with:
191191
name: dist
192192
path: packages/core/dist
193193
- name: Download ts3.8
194-
uses: actions/download-artifact@v7
194+
uses: actions/download-artifact@v8
195195
with:
196196
name: ts3.8
197197
path: packages/core/ts3.8
@@ -217,12 +217,12 @@ jobs:
217217
- name: Install Dependencies
218218
run: yarn install
219219
- name: Download dist
220-
uses: actions/download-artifact@v7
220+
uses: actions/download-artifact@v8
221221
with:
222222
name: dist
223223
path: packages/core/dist
224224
- name: Download Expo Plugin
225-
uses: actions/download-artifact@v7
225+
uses: actions/download-artifact@v8
226226
with:
227227
name: expo-plugin
228228
path: packages/core/plugin/build

.github/workflows/cancel-pr-workflows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Cancel in-progress workflow runs
13-
uses: actions/github-script@v7
13+
uses: actions/github-script@v8
1414
with:
1515
script: |
1616
const { owner, repo } = context.repo;

.github/workflows/e2e-v2.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,15 +299,15 @@ jobs:
299299

300300
- name: Upload App
301301
if: matrix.build-type == 'production'
302-
uses: actions/upload-artifact@v6
302+
uses: actions/upload-artifact@v7
303303
with:
304304
name: ${{ matrix.rn-version }}-${{ matrix.rn-architecture }}-${{ matrix.engine }}-${{ matrix.platform }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks }}-app-package
305305
path: dev-packages/e2e-tests/RnDiffApp.ap*
306306
retention-days: 1
307307

308308
- name: Upload logs
309309
if: ${{ always() }}
310-
uses: actions/upload-artifact@v6
310+
uses: actions/upload-artifact@v7
311311
with:
312312
name: rn-build-logs-${{ matrix.rn-version }}-${{ matrix.rn-architecture }}-${{ matrix.engine }}-${{ matrix.platform }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks }}
313313
path: dev-packages/e2e-tests/react-native-versions/${{ matrix.rn-version }}/RnDiffApp/ios/*.log
@@ -357,7 +357,7 @@ jobs:
357357

358358
- name: Download App Package
359359
if: matrix.build-type == 'production'
360-
uses: actions/download-artifact@v7
360+
uses: actions/download-artifact@v8
361361
with:
362362
name: ${{ matrix.rn-version }}-${{ matrix.rn-architecture }}-${{ matrix.engine }}-${{ matrix.platform }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks }}-app-package
363363
path: dev-packages/e2e-tests
@@ -423,7 +423,7 @@ jobs:
423423
if: ${{ matrix.platform == 'ios' }}
424424
run: xcrun simctl list devices available
425425

426-
- uses: futureware-tech/simulator-action@dab10d813144ef59b48d401cd95da151222ef8cd # pin@v4
426+
- uses: futureware-tech/simulator-action@e89aa8f93d3aec35083ff49d2854d07f7186f7f5 # pin@v5
427427
if: ${{ matrix.platform == 'ios' }}
428428
with:
429429
model: ${{ env.IOS_DEVICE }}
@@ -438,7 +438,7 @@ jobs:
438438

439439
- name: Upload logs
440440
if: ${{ always() }}
441-
uses: actions/upload-artifact@v6
441+
uses: actions/upload-artifact@v7
442442
with:
443443
name: ${{ matrix.rn-version }}-${{ matrix.rn-architecture }}-${{ matrix.engine }}-${{ matrix.platform }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks }}-logs
444444
path: |

.github/workflows/sample-application-expo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ jobs:
162162
163163
- name: Upload logs
164164
if: ${{ always() }}
165-
uses: actions/upload-artifact@v6
165+
uses: actions/upload-artifact@v7
166166
with:
167167
name: build-sample-expo-${{ matrix.platform }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-logs
168168
path: samples/expo/${{ matrix.platform }}/*.log

.github/workflows/sample-application.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,23 +184,23 @@ jobs:
184184
185185
- name: Upload iOS APP
186186
if: ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
187-
uses: actions/upload-artifact@v6
187+
uses: actions/upload-artifact@v7
188188
with:
189189
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-${{ matrix.platform }}
190190
path: ${{ env.IOS_APP_ARCHIVE_PATH }}
191191
retention-days: 1
192192

193193
- name: Upload Android APK
194194
if: ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
195-
uses: actions/upload-artifact@v6
195+
uses: actions/upload-artifact@v7
196196
with:
197197
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}
198198
path: ${{ env.ANDROID_APP_ARCHIVE_PATH }}
199199
retention-days: 1
200200

201201
- name: Upload logs
202202
if: ${{ always() }}
203-
uses: actions/upload-artifact@v6
203+
uses: actions/upload-artifact@v7
204204
with:
205205
name: build-sample-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-logs
206206
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/${{ matrix.platform }}/*.log
@@ -236,14 +236,14 @@ jobs:
236236

237237
- name: Download iOS App Archive
238238
if: ${{ matrix.platform == 'ios' }}
239-
uses: actions/download-artifact@v7
239+
uses: actions/download-artifact@v8
240240
with:
241241
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-${{ matrix.platform }}
242242
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
243243

244244
- name: Download Android APK
245245
if: ${{ matrix.platform == 'android' }}
246-
uses: actions/download-artifact@v7
246+
uses: actions/download-artifact@v8
247247
with:
248248
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}
249249
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
@@ -294,7 +294,7 @@ jobs:
294294
sudo udevadm trigger --name-match=kvm
295295
296296
- name: Boot ${{ env.IOS_DEVICE }} with iOS ${{ env.IOS_VERSION }}
297-
uses: futureware-tech/simulator-action@dab10d813144ef59b48d401cd95da151222ef8cd # pin@v4
297+
uses: futureware-tech/simulator-action@e89aa8f93d3aec35083ff49d2854d07f7186f7f5 # pin@v5
298298
if: ${{ matrix.platform == 'ios' }}
299299
with:
300300
model: ${{ env.IOS_DEVICE }}

.github/workflows/testflight.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
bundle exec fastlane ios upload_react_native_sample_to_testflight
7272
7373
- name: Upload Xcode Archive
74-
uses: actions/upload-artifact@v6
74+
uses: actions/upload-artifact@v7
7575
with:
7676
name: sentry-react-native-sample-xcode-archive-for-testflight
7777
path: samples/react-native/sentryreactnativesample.xcarchive

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
99
## Unreleased
1010

11+
### Fixes
12+
13+
- Resolve relative `SOURCEMAP_FILE` paths against the project root in the Xcode build script ([#5730](https://github.com/getsentry/sentry-react-native/pull/5730))
14+
- Fixes the issue with unit mismatch in `adjustTransactionDuration` ([#5740](https://github.com/getsentry/sentry-react-native/pull/5740))
15+
- Handle `inactive` state for spans ([#5742](https://github.com/getsentry/sentry-react-native/pull/5742))
16+
1117
### Dependencies
1218

1319
- Bump JavaScript SDK from v10.39.0 to v10.40.0 ([#5715](https://github.com/getsentry/sentry-react-native/pull/5715))

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@
6060
],
6161
"resolutions": {
6262
"appium-chromedriver@npm:5.6.73/@xmldom/xmldom": "0.8.10",
63+
"express@npm:4.19.2/path-to-regexp": "0.1.12",
64+
"axios": "^1.13.5",
6365
"fast-xml-parser": "^5.3.6",
64-
"form-data": "4.0.4",
66+
"form-data": "4.0.5",
6567
"qs": "^6.14.2",
6668
"lodash": "^4.17.23",
6769
"tar-fs": "^3.1.1",

packages/core/scripts/sentry-xcode.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ RN_PROJECT_ROOT="${PROJECT_DIR}/.."
1515
[ -z "$SENTRY_PROPERTIES" ] && export SENTRY_PROPERTIES=sentry.properties
1616
[ -z "$SENTRY_DOTENV_PATH" ] && [ -f "$RN_PROJECT_ROOT/.env.sentry-build-plugin" ] && export SENTRY_DOTENV_PATH="$RN_PROJECT_ROOT/.env.sentry-build-plugin"
1717
[ -z "$SOURCEMAP_FILE" ] && export SOURCEMAP_FILE="$DERIVED_FILE_DIR/main.jsbundle.map"
18+
# Resolve relative SOURCEMAP_FILE to absolute. The script runs from `ios/` (Xcode's PWD),
19+
# but users typically specify paths relative to the project root. Without this, sentry-cli
20+
# would resolve relative paths against `ios/` and fail to find the file.
21+
# See: https://github.com/getsentry/sentry-react-native/issues/3889
22+
if [[ "$SOURCEMAP_FILE" != /* ]]; then
23+
export SOURCEMAP_FILE="$(cd "$RN_PROJECT_ROOT" && pwd)/${SOURCEMAP_FILE#./}"
24+
fi
1825

1926
if [ -z "$SENTRY_CLI_EXECUTABLE" ]; then
2027
# Try standard resolution safely

packages/core/src/js/tracing/onSpanEndUtils.ts

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
import type { Client, Span } from '@sentry/core';
22
import { debug, getSpanDescendants, SPAN_STATUS_ERROR, spanToJSON } from '@sentry/core';
33
import type { AppStateStatus } from 'react-native';
4-
import { AppState } from 'react-native';
4+
import { AppState, Platform } from 'react-native';
55
import { isRootSpan, isSentrySpan } from '../utils/span';
66

7+
/**
8+
* The time to wait after the app enters the `inactive` state on iOS before
9+
* cancelling the span.
10+
*/
11+
const IOS_INACTIVE_CANCEL_DELAY_MS = 5_000;
12+
713
/**
814
* Hooks on span end event to execute a callback when the span ends.
915
*/
@@ -33,8 +39,9 @@ export const adjustTransactionDuration = (client: Client, span: Span, maxDuratio
3339
return;
3440
}
3541

36-
const diff = endTimestamp - startTimestamp;
37-
const isOutdatedTransaction = endTimestamp && (diff > maxDurationMs || diff < 0);
42+
const diff = endTimestamp - startTimestamp; // a diff in *seconds*
43+
const isOutdatedTransaction = diff > maxDurationMs / 1000 || diff < 0;
44+
3845
if (isOutdatedTransaction) {
3946
span.setStatus({ code: SPAN_STATUS_ERROR, message: 'deadline_exceeded' });
4047
// TODO: check where was used, might be possible to delete
@@ -174,20 +181,54 @@ export const onlySampleIfChildSpans = (client: Client, span: Span): void => {
174181

175182
/**
176183
* Hooks on AppState change to cancel the span if the app goes background.
184+
*
185+
* On iOS the JS thread can be suspended between the `inactive` and
186+
* `background` transitions, which means the `background` event may never
187+
* reach JS in time. To handle this we schedule a deferred cancellation when
188+
* the app becomes `inactive`. If the app returns to `active` before the
189+
* timeout fires, the cancellation is cleared. If it transitions to
190+
* `background` first, we cancel immediately and clear the timeout.
177191
*/
178192
export const cancelInBackground = (client: Client, span: Span): void => {
193+
let inactiveTimeout: ReturnType<typeof setTimeout> | undefined;
194+
195+
const cancelSpan = (): void => {
196+
if (inactiveTimeout !== undefined) {
197+
clearTimeout(inactiveTimeout);
198+
inactiveTimeout = undefined;
199+
}
200+
debug.log(`Setting ${spanToJSON(span).op} transaction to cancelled because the app is in the background.`);
201+
span.setStatus({ code: SPAN_STATUS_ERROR, message: 'cancelled' });
202+
span.end();
203+
};
204+
179205
const subscription = AppState.addEventListener('change', (newState: AppStateStatus) => {
180206
if (newState === 'background') {
181-
debug.log(`Setting ${spanToJSON(span).op} transaction to cancelled because the app is in the background.`);
182-
span.setStatus({ code: SPAN_STATUS_ERROR, message: 'cancelled' });
183-
span.end();
207+
cancelSpan();
208+
} else if (Platform.OS === 'ios' && newState === 'inactive') {
209+
// Schedule a deferred cancellation — if the JS thread is suspended
210+
// before the 'background' event fires, this timer will execute when
211+
// the app is eventually resumed and end the span.
212+
if (inactiveTimeout === undefined) {
213+
inactiveTimeout = setTimeout(cancelSpan, IOS_INACTIVE_CANCEL_DELAY_MS);
214+
}
215+
} else if (newState === 'active') {
216+
// App returned to foreground — clear any pending inactive cancellation.
217+
if (inactiveTimeout !== undefined) {
218+
clearTimeout(inactiveTimeout);
219+
inactiveTimeout = undefined;
220+
}
184221
}
185222
});
186223

187224
subscription &&
188225
client.on('spanEnd', (endedSpan: Span) => {
189226
if (endedSpan === span) {
190227
debug.log(`Removing AppState listener for ${spanToJSON(span).op} transaction.`);
228+
if (inactiveTimeout !== undefined) {
229+
clearTimeout(inactiveTimeout);
230+
inactiveTimeout = undefined;
231+
}
191232
subscription?.remove?.();
192233
}
193234
});

0 commit comments

Comments
 (0)