Skip to content

Different trace IDs are sent to Sentry and in the HTTP Request Header #3067

Description

@db-dblank

Platform

Flutter Web

Obfuscation

Disabled

Debug Info

Disabled

Doctor

[✓] Flutter (Channel stable, 3.32.5, on macOS 15.4.1 24E263 darwin-arm64, locale en-BR) [672ms]
• Flutter version 3.32.5 on channel stable at /Users/abc/Documents/dev/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision fcf2c11572 (2 weeks ago), 2025-06-24 11:44:07 -0700
• Engine revision dd93de6fb1
• Dart version 3.8.1
• DevTools version 2.45.1

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [4.5s]
• Android SDK at /Users/abc/Library/Android/sdk
• Platform android-35, build-tools 35.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: flutter config --jdk-dir="path/to/jdk".
• Java version OpenJDK Runtime Environment (build 21.0.4+-12422083-b607.1)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.1) [1,922ms]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16B40
• CocoaPods version 1.16.2

[✓] Chrome - develop for the web [14ms]
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.2) [13ms]
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 21.0.4+-12422083-b607.1)

[✓] VS Code (version 1.100.3) [11ms]
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.114.0

[✓] Connected device (2 available) [12.1s]
• macOS (desktop) • macos • darwin-arm64 • macOS 15.4.1 24E263 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 138.0.7204.101
! Error: Browsing on the local area network for iPhone Xs DB . Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources [623ms]
• All expected network resources are available.

• No issues found!

Version

9.3.0

Steps to Reproduce

When capturing an exception using withScope, the trace ID sent in the event to Sentry is different from the one sent in the HTTP Request Header.

Sentry.captureException(
  error,
  stackTrace: stackTrace,
  withScope: (scope) async {
    for (final entry in extras.entries) {
      await scope.setContexts(entry.key, entry.value);
    }
  },
);

HTTP Request Header:

sentry-trace: 4b32cb0857124b56af93eca96a24e9ee-a9ccf4eb61af4616

The reason is that propagationContext is not being copied when the scope is cloned.

final clone = Scope(_options)
..level = level
..fingerprint = List.from(fingerprint)
.._transaction = _transaction
..span = span
.._enableScopeSync = false
.._replayId = _replayId;

Expected Result

The same trace ID is sent to Sentry and in the HTTP Request Header

Actual Result

Different trace IDs are sent to Sentry and in the HTTP Request Header

Are you willing to submit a PR?

None

Metadata

Metadata

Assignees

Labels

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions